Different Ways To Add A Foreign Key Reference
create_table :books
t.references :author, foreign_key: true
endcreate_table :books
t.references :author, index: true, foreign_key: true, type: :uuid, null: false
endcreate_table :books
t.references :written_by, foreign_key: { to_table: :authors }
enddef up
add_reference :books, :author, index: true, foreign_key: true
endLast updated