You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
454 B

  1. class CreateBookmarks < ActiveRecord::Migration[5.1]
  2. def change
  3. create_table :bookmarks do |t|
  4. t.references :account, null: false
  5. t.references :status, null: false
  6. t.timestamps
  7. end
  8. add_foreign_key :bookmarks, :accounts, column: :account_id, on_delete: :cascade
  9. add_foreign_key :bookmarks, :statuses, column: :status_id, on_delete: :cascade
  10. add_index :bookmarks, [:account_id, :status_id], unique: true
  11. end
  12. end