Gab-Social/db/migrate/20190716173227_create_group_removed_accounts.rb

13 lines
461 B
Ruby

class CreateGroupRemovedAccounts < ActiveRecord::Migration[5.2]
def change
create_table :group_removed_accounts do |t|
t.belongs_to :group, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
t.timestamps
end
add_index :group_removed_accounts, [:account_id, :group_id], unique: true
add_index :group_removed_accounts, [:group_id, :account_id]
end
end