2015-09-08 09:30:11 +00:00
|
|
|
class CreateTransactions < ActiveRecord::Migration
|
|
|
|
def change
|
|
|
|
create_table :transactions do |t|
|
2015-09-08 13:37:02 +00:00
|
|
|
t.references :debtor, index: true, null: false
|
|
|
|
t.references :creditor, index: true, null: false
|
2015-09-09 10:49:24 +00:00
|
|
|
t.references :issuer, polymorphic: true, index: true, null: false
|
2015-09-08 09:44:07 +00:00
|
|
|
t.integer :amount, null: false, default: 0
|
2015-09-08 09:30:11 +00:00
|
|
|
t.string :message
|
|
|
|
|
|
|
|
t.timestamps null: false
|
|
|
|
end
|
2015-09-08 13:37:02 +00:00
|
|
|
|
2015-09-08 13:42:08 +00:00
|
|
|
add_foreign_key :transactions, :users, column: :creditor_id
|
|
|
|
add_foreign_key :transactions, :users, column: :debtor_id
|
2015-09-08 09:30:11 +00:00
|
|
|
end
|
|
|
|
end
|