aboutsummaryrefslogtreecommitdiffstats
path: root/db/normalized/orders.js
blob: 06e83db1ddc8eb202aea4e578437b5e6c8450a52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export const up = function(knex) {
  return knex.schema.createTable('orders', function(t) {
    t.increments('id').unsigned().primary();

    t.int('sell_transfer_id').notNull();
    t.foreign('sell_transfer_id').references('transfers.id');
    
    t.int('buy_transfer_id').notNull();
    t.foreign('buy_transfer_id').references('transfers.id');

    // t.int('exchange_id').notNull();
    // t.foreign('exchange_id').references('exchanges.id');

    t.double('exchange_rate').notNull();
    // t.double('amount').notNull();

    t.enu('status', ['Submitted', 'Accepted', 'Cancelled']).notNull();
    t.date('completion_date')

    t.timestamps();
  })
};

// Bid / Accepted ... separate into Bid (credit + debit),  Accepted (credit + debit)

export const down = function(knex) {
  return knex.schema.dropTable('orders');
};