Lots of development

This commit is contained in:
Josh Harvey 2017-03-31 16:45:14 +03:00
parent 5cbec6bd23
commit 3a244f691e
19 changed files with 594 additions and 837 deletions

View file

@ -0,0 +1,23 @@
var db = require('./db')
exports.up = function (next) {
var sql = [
'create sequence hd_indices_seq minvalue 0 maxvalue 2147483647',
'alter table cash_out_txs add column hd_index integer',
'alter sequence hd_indices_seq owned by cash_out_txs.hd_index',
"alter table cash_out_txs add column swept boolean not null default 'f'",
'alter table cash_out_txs drop column tx_hash',
'create unique index on cash_out_txs (hd_index)',
'drop table cash_out_hds',
'drop table cash_out_actions',
'drop table transactions',
'drop table idempotents',
'drop table machine_configs',
'drop table pending_transactions'
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}

View file

@ -0,0 +1,20 @@
var db = require('./db')
exports.up = function (next) {
var sql = [
"create type trade_type as enum ('buy', 'sell')",
`create table trades (
id serial PRIMARY KEY,
type trade_type not null,
crypto_code text not null,
crypto_atoms bigint not null,
fiat_code text not null,
created timestamptz NOT NULL default now()
)`
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}