Sha256: 4780f0a4dcc04a39047e5e67d07f392249573ad96999e0282147b328cd91cc9a
Contents?: true
Size: 705 Bytes
Versions: 16
Compression:
Stored size: 705 Bytes
Contents
class CreateBitCoreTools < ActiveRecord::Migration def change create_table :bit_core_tools do |t| t.string :title, null: false, unique: true t.integer :position, null: false, default: 0 t.timestamps end reversible do |dir| dir.up do # make deferrable so that positions can be updated execute <<-SQL ALTER TABLE bit_core_tools ADD CONSTRAINT bit_core_tool_position UNIQUE (position) DEFERRABLE INITIALLY IMMEDIATE SQL end dir.down do execute <<-SQL ALTER TABLE bit_core_tools DROP CONSTRAINT IF EXISTS bit_core_tool_position SQL end end end end
Version data entries
16 entries across 16 versions & 1 rubygems