fix transaction foreign keys

This commit is contained in:
Ilion Beyst 2015-09-08 15:37:02 +02:00
parent 9cbd5a141c
commit aadf615122

View file

@ -1,13 +1,16 @@
class CreateTransactions < ActiveRecord::Migration
def change
create_table :transactions do |t|
t.references :debtor, index: true, foreign_key: true, null: false
t.references :creditor, index: true, foreign_key: true, null: false
t.references :debtor, index: true, null: false
t.references :creditor, index: true, null: false
t.integer :amount, null: false, default: 0
t.string :origin, null: false
t.string :message
t.timestamps null: false
end
add_foreign_key :transactions, :users, :creditor_id
add_foreign_key :transactions, :users, :debtor_id
end
end