2017-01-09 15:46:43 +01:00
|
|
|
class CreateRequests < ActiveRecord::Migration
|
|
|
|
def change
|
|
|
|
create_table :requests do |t|
|
|
|
|
t.references :debtor, index: true, null: false
|
|
|
|
t.references :creditor, index: true, null: false
|
|
|
|
t.references :issuer, polymorphic: true, index: true, null: false
|
|
|
|
t.integer :amount, null: false, default: 0
|
|
|
|
t.string :message
|
|
|
|
|
|
|
|
t.integer :status, default: 0
|
|
|
|
|
|
|
|
t.timestamps null: false
|
|
|
|
end
|
|
|
|
|
2017-01-16 23:03:37 +01:00
|
|
|
add_foreign_key :requests, :users, column: :creditor_id
|
|
|
|
add_foreign_key :requests, :users, column: :debtor_id
|
2017-01-09 15:46:43 +01:00
|
|
|
end
|
|
|
|
end
|