feat: create relations between trades and transactions
This commit is contained in:
parent
b78d4cff08
commit
ce48360f04
2 changed files with 44 additions and 2 deletions
22
migrations/1616687417371-add_internal_tx_to_trades.js
Normal file
22
migrations/1616687417371-add_internal_tx_to_trades.js
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue