The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

18 lines
489 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. safety_assured do
  9. add_foreign_key :bookmarks, :accounts, column: :account_id, on_delete: :cascade
  10. add_foreign_key :bookmarks, :statuses, column: :status_id, on_delete: :cascade
  11. end
  12. add_index :bookmarks, [:account_id, :status_id], unique: true
  13. end
  14. end