2012-05-04 18:12:51 +01:00
|
|
|
class CreateAdvisoriesPlatforms < ActiveRecord::Migration
|
|
|
|
def up
|
2014-01-21 04:51:49 +00:00
|
|
|
create_table :advisories_platforms, id: false do |t|
|
2012-05-04 18:12:51 +01:00
|
|
|
t.integer :advisory_id
|
|
|
|
t.integer :platform_id
|
|
|
|
end
|
|
|
|
add_index :advisories_platforms, :advisory_id
|
|
|
|
add_index :advisories_platforms, :platform_id
|
2014-01-21 04:51:49 +00:00
|
|
|
add_index :advisories_platforms, [:advisory_id, :platform_id], name: :advisory_platform_index, unique: true
|
2012-05-04 18:12:51 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2014-01-21 04:51:49 +00:00
|
|
|
remove_index :advisories_platforms, column: :advisory_id
|
|
|
|
remove_index :advisories_platforms, column: :platform_id
|
|
|
|
remove_index :advisories_platforms, name: :advisory_platform_index
|
2012-05-04 18:12:51 +01:00
|
|
|
drop_table :advisories_platforms
|
|
|
|
end
|
|
|
|
end
|