Sha256: ce0f5edfa6fb411e405d3e015bd64ce4ace63c75327dd86e688d429a9467fb8c

Contents?: true

Size: 601 Bytes

Versions: 68

Compression:

Stored size: 601 Bytes

Contents

# This migration comes from bit_core (originally 20150210161229)
class AddToolConstraint < ActiveRecord::Migration
  def change
    BitCore::Tool.all.each do |t|
      t.destroy! if t.arm.nil?
    end

    reversible do |dir|
      dir.up do
        execute <<-SQL
          ALTER TABLE bit_core_tools
            ADD CONSTRAINT fk_tools_arms
            FOREIGN KEY (arm_id)
            REFERENCES arms(id)
        SQL
      end

      dir.down do
        execute <<-SQL
          ALTER TABLE bit_core_tools
            DROP CONSTRAINT IF EXISTS fk_tools_arms
        SQL
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.14.8 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.7 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.6 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.5 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.4 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.3 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.2 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.1 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.14.0 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.13.1 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.13.0 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.9 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.8 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.7 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.6 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.5 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.4 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.3 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.2 db/migrate/20150210165021_add_tool_constraint.bit_core.rb
think_feel_do_engine-3.12.1 db/migrate/20150210165021_add_tool_constraint.bit_core.rb