tab/db/migrate/20150908091546_create_transactions.rb
2015-09-08 15:42:08 +02:00

16 lines
496 B
Ruby

class CreateTransactions < ActiveRecord::Migration
def change
create_table :transactions do |t|
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, column: :creditor_id
add_foreign_key :transactions, :users, column: :debtor_id
end
end