20171116161857_create_list_accounts.rb 513 B

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