migrate: update latest migration

This commit is contained in:
Javed Khan 2019-04-18 20:33:22 +05:30 committed by Braydon Fuller
parent ed06c2184d
commit 5111af0615
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
const assert = require('assert');
const fs = require('fs');
'use strict';
const cp = require('child_process');
const res = require('path').resolve;
const {argv} = process;
@ -13,14 +13,6 @@ if (argv.length < 3) {
return;
}
function mv(from, to) {
try {
fs.renameSync(from, to);
} catch (e) {
console.error(e.message);
}
}
function exec(file, ...args) {
try {
const result = cp.spawnSync(file, args, {
@ -39,11 +31,8 @@ function exec(file, ...args) {
const node = argv[0];
const prefix = argv[2];
mv(res(prefix, 'chain.ldb'), res(prefix, 'chain'));
mv(res(prefix, 'spvchain.ldb'), res(prefix, 'spvchain'));
mv(res(prefix, 'mempool.ldb'), res(prefix, 'mempool'));
mv(res(prefix, 'walletdb.ldb'), res(prefix, 'wallet'));
exec(node, res(__dirname, 'chaindb3to4.js'), res(prefix, 'chain'));
exec(node, res(__dirname, 'chaindb3to4.js'), res(prefix, 'spvchain'));
exec(node, res(__dirname, 'chaindb4to5.js'), res(prefix, 'chain'));
exec(node, res(__dirname, 'chaindb5to6.js'), res(prefix, 'chain'));
exec(node, res(__dirname, 'walletdb6to7.js'), res(prefix, 'wallet'));