20171116161857_create_list_accounts.rb 482 B

123456789101112
  1. class CreateListAccounts < ActiveRecord::Migration[5.1]
  2. def change
  3. create_table :list_accounts do |t|
  4. t.belongs_to :list, foreign_key: { on_delete: :cascade }, null: false
  5. t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
  6. t.belongs_to :follow, foreign_key: { on_delete: :cascade }, null: false
  7. end
  8. add_index :list_accounts, [:account_id, :list_id], unique: true
  9. add_index :list_accounts, [:list_id, :account_id]
  10. end
  11. end