Migration sql changes (#199)

* safe migration script changes

* lamassu migration script fixes
This commit is contained in:
Fabio Cigliano 2018-11-02 00:26:48 +13:00 committed by Josh Harvey
parent 65ce8aee3d
commit 12c834469c
53 changed files with 500 additions and 346 deletions

View file

@ -2,18 +2,18 @@ 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',
db.addSequence('hd_indices_seq', 'minvalue 0 maxvalue 2147483647'),
db.addColumn('cash_out_txs', 'hd_index', 'integer'),
db.alterSequence('hd_indices_seq', 'owned by cash_out_txs.hd_index'),
db.addColumn('cash_out_txs', 'swept', 'boolean not null default \'f\''),
db.dropColumn('cash_out_txs', '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'
'drop table if exists cash_out_hds',
'drop table if exists cash_out_actions',
'drop table if exists transactions',
'drop table if exists idempotents',
'drop table if exists machine_configs',
'drop table if exists pending_transactions'
]
db.multi(sql, next)
}