Sha256: 4eea79124f363a4e1929dc19a8c0c7159b75b85224b4d017bbb55abdb68b95db

Contents?: true

Size: 614 Bytes

Versions: 5

Compression:

Stored size: 614 Bytes

Contents

class AddArmIdToBitCoreTools < ActiveRecord::Migration
  def change
    add_column :bit_core_tools, :arm_id, :integer, null: false

    reversible do |dir|
      dir.up do
        # add foreign key constaint
        execute <<-SQL
          ALTER TABLE bit_core_tools
            ADD CONSTRAINT fk_bit_core_tools_arms
            FOREIGN KEY (arm_id)
            REFERENCES arms(id)
        SQL
      end

      dir.down do
        # remove foreign key constaint
        execute <<-SQL
          ALTER TABLE bit_core_tools
            DROP CONSTRAINT fk_bit_core_tools_arms
        SQL
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bit_core-1.4.7 db/migrate/20141205202740_add_arm_id_to_bit_core_tools.rb
bit_core-2.0.0.beta2 db/migrate/20141205202740_add_arm_id_to_bit_core_tools.rb
bit_core-2.0.0.beta1 db/migrate/20141205202740_add_arm_id_to_bit_core_tools.rb
bit_core-1.4.6 db/migrate/20141205202740_add_arm_id_to_bit_core_tools.rb
bit_core-1.4.5 db/migrate/20141205202740_add_arm_id_to_bit_core_tools.rb