lamassu-server/migrations/1606910357208-change-trades.js
2021-01-18 19:42:03 +00:00

16 lines
467 B
JavaScript

const db = require('./db')
exports.up = function (next) {
var sql = [
'ALTER TABLE trades ADD COLUMN tx_in_id UUID UNIQUE',
'ALTER TABLE trades ADD CONSTRAINT fk_tx_in FOREIGN KEY (tx_in_id) REFERENCES cash_in_txs (id)',
'ALTER TABLE trades ADD COLUMN tx_out_id UUID UNIQUE',
'ALTER TABLE trades ADD CONSTRAINT fk_tx_out FOREIGN KEY (tx_in_id) REFERENCES cash_out_txs (id)'
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}