📅  最后修改于: 2022-03-11 15:04:46.384000             🧑  作者: Mango
// dont do a foreing_key, instead use t.references
class CreateDocumentImages < ActiveRecord::Migration[5.1]
def change
create_table :document_images do |t|
t.references :document, foreign_key: { on_delete: :cascade }
t.references :image, foreign_key: { on_delete: :cascade}
t.timestamps
end
end
end