feat: create relations between trades and transactions

This commit is contained in:
José Oliveira 2021-03-26 13:58:06 +00:00 committed by Josh Harvey
parent b78d4cff08
commit ce48360f04
2 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,22 @@
const db = require('./db')
exports.up = function (next) {
var sql = [
`CREATE TABLE cashout_tx_trades (
cash_out_tx_id uuid REFERENCES cash_out_txs(id),
trade_id serial REFERENCES trades(id),
CONSTRAINT cashout_trade_pkey PRIMARY KEY (cash_out_tx_id,trade_id)
)`,
`CREATE TABLE cashin_tx_trades (
cash_in_tx_id uuid REFERENCES cash_in_txs(id),
trade_id serial REFERENCES trades(id),
CONSTRAINT cashin_trade_pkey PRIMARY KEY (cash_in_tx_id,trade_id)
)`
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}