There are some rules which only affect migration files, and we cannot enable them if we're excluding those files from being inspected. We're also changing migrations related to the Rails/TimeZone rule slightly because these fields were already changed afterwards, so we aren't changing the schema.
13 lines
690 B
Ruby
13 lines
690 B
Ruby
class CreateRelatedContent < ActiveRecord::Migration[4.2]
|
|
def change
|
|
create_table :related_contents do |t|
|
|
t.references :parent_relationable, polymorphic: true, index: { name: "index_related_contents_on_parent_relationable" }
|
|
t.references :child_relationable, polymorphic: true, index: { name: "index_related_contents_on_child_relationable" }
|
|
t.references :related_content, index: { name: "opposite_related_content" }
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :related_contents, [:parent_relationable_id, :parent_relationable_type, :child_relationable_id, :child_relationable_type], name: "unique_parent_child_related_content", unique: true, using: :btree
|
|
end
|
|
end
|