check if migration needed

This commit is contained in:
Mark Nadal 2020-03-06 01:35:14 -08:00
parent 9de7d0f38d
commit 4163687acb
2 changed files with 26 additions and 1 deletions

View File

@ -294,9 +294,10 @@
if(o.parsed >= o.limit){ return }
var S = +new Date;
DBG && (DBG.rm = S);
var next = o.next;
timediate(function(){
console.STAT && console.STAT(S, +new Date - S, 'rad more');
r.parse(o.next, g.check);
r.parse(next, g.check);
},0);
}
g.check = function(err, disk, info){
@ -498,6 +499,8 @@
}
}());
try{ !Gun.window && require('./radmigtmp')(r) }catch(e){}
var noop = function(){}, RAD, u;
Radisk.has[opt.file] = r;
return r;

22
lib/radmigtmp.js Normal file
View File

@ -0,0 +1,22 @@
module.exports = function(r){
var Radix = require('./radix');
r.find('a', function(){
var l = [];
Radix.map(r.list, function(v,f){
if(!(f.indexOf('%1B') + 1)){ return }
if(!v){ return }
l.push([f,v]);
});
if(l.length){
console.log("\n! ! ! WARNING ! ! !\nRAD v0.2020.x has detected OLD v0.2019.x data & automatically migrating. Automatic migration will be turned OFF in future versions! If you are just developing/testing, we recommend you reset your data. Please contact us if you have any concerns.\nThis message should only log once.")
}
var f, v;
l.forEach(function(a){
f = a[0]; v = a[1];
r.list(decodeURIComponent(f), v);
r.list(f, 0);
});
if(!f){ return }
r.find.bad(f);
})
};