Browse Source

migration script

activeAddress
Ivan Socolsky 10 years ago
parent
commit
aecd12b5be
  1. 4
      scripts/level2mongo.js

4
scripts/level2mongo.js

@ -2,7 +2,7 @@
var LevelStorage = require('../lib/storage_leveldb');
var MongoStorage = require('../lib/storage');
var Bitcore = require('bitcore');
var level = new LevelStorage({
dbPath: './db',
@ -60,11 +60,13 @@ function migrate(key, value, cb) {
mongo.db.collection('copayers_lookup').insert(value, cb);
} else if (key.match(/!addr!/)) {
value.walletId = key.substring(2, key.indexOf('!addr'));
value.network = Bitcore.Address(value.address).toObject().network;
mongo.db.collection('addresses').insert(value, cb);
} else if (key.match(/!not!/)) {
mongo.db.collection('notifications').insert(value, cb);
} else if (key.match(/!p?txp!/)) {
value.isPending = key.indexOf('!ptxp!') != -1;
value.network = Bitcore.Address(value.toAddress).toObject().network;
mongo.db.collection('txs').insert(value, cb);
} else if (key.match(/!main$/)) {
mongo.db.collection('wallets').insert(value, cb);

Loading…
Cancel
Save