Files
nairobi/db/migrate/20171127171925_create_related_content.rb
Javi Martín a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00

20 lines
842 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