Sha256: 9b7ecfb0170b2e4560f86f5d1087316fe69d993b1c8bbb16343b3d2f511d6ae3
Contents?: true
Size: 1.09 KB
Versions: 16
Compression:
Stored size: 1.09 KB
Contents
class CreateBitCoreContentModules < ActiveRecord::Migration def change create_table :bit_core_content_modules do |t| t.string :title, null: false t.integer :position, null: false, default: 1 t.integer :bit_core_tool_id, null: false t.timestamps end reversible do |dir| dir.up do execute <<-SQL ALTER TABLE bit_core_content_modules ADD CONSTRAINT bit_core_content_module_position UNIQUE (bit_core_tool_id, position) DEFERRABLE INITIALLY IMMEDIATE SQL execute <<-SQL ALTER TABLE bit_core_content_modules ADD CONSTRAINT fk_content_modules_tools FOREIGN KEY (bit_core_tool_id) REFERENCES bit_core_tools(id) SQL end dir.down do execute <<-SQL ALTER TABLE bit_core_content_modules DROP CONSTRAINT fk_content_modules_tools SQL execute <<-SQL ALTER TABLE bit_core_content_modules DROP CONSTRAINT IF EXISTS bit_core_content_module_position SQL end end end end
Version data entries
16 entries across 16 versions & 1 rubygems