19 lines
449 B
Ruby
19 lines
449 B
Ruby
|
|
class CreateWorkSidePairings < ActiveRecord::Migration[7.0]
|
||
|
|
def change
|
||
|
|
create_table :work_side_pairings do |t|
|
||
|
|
t.references :work,
|
||
|
|
null: false,
|
||
|
|
type: :integer,
|
||
|
|
foreign_key: true
|
||
|
|
t.references :relationship,
|
||
|
|
null: false,
|
||
|
|
type: :integer,
|
||
|
|
foreign_key: { to_table: :tags }
|
||
|
|
t.timestamps
|
||
|
|
end
|
||
|
|
add_index :work_side_pairings,
|
||
|
|
[:work_id, :relationship_id],
|
||
|
|
unique: true,
|
||
|
|
name: "index_work_side_pairings_unique"
|
||
|
|
end
|
||
|
|
end
|