class CreateAccountingCafeteriaTransactions < ActiveRecord::Migration[6.0]
  def change
    create_table :accounting_cafeteria_transactions do |t|
      t.references :transaction, null: false, index: false,
        foreign_key: { to_table: :accounting_transactions }
      t.references :cafeteria_transaction, type: :integer, null: false, index: false,
        foreign_key: { to_table: :LunchTransactionsStudents, primary_key: :LTID }

      t.index [:transaction_id, :cafeteria_transaction_id], unique: true,
        name: :cafeteria_transactions_index
    end
  end
end
