20180808175627_create_account_pins.rb 413 B

1234567891011121314
  1. # frozen_string_literal: true
  2. class CreateAccountPins < ActiveRecord::Migration[5.2]
  3. def change
  4. create_table :account_pins do |t|
  5. t.belongs_to :account, foreign_key: { on_delete: :cascade }
  6. t.belongs_to :target_account, foreign_key: { on_delete: :cascade, to_table: :accounts }
  7. t.timestamps
  8. end
  9. add_index :account_pins, [:account_id, :target_account_id], unique: true
  10. end
  11. end