mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-09 04:03:16 +02:00
upgrade script fixes
This commit is contained in:
@@ -84,19 +84,15 @@ Upgrade.check = function (callback) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
console.log('available vs executed', files.length, executed.length);
|
||||
|
||||
var remainder = files.filter(function (name) {
|
||||
return executed.indexOf(path.basename(name, '.js')) === -1;
|
||||
});
|
||||
|
||||
next(remainder.length > 1 ? new Error('schema-out-of-date') : null);
|
||||
next(remainder.length > 0 ? new Error('schema-out-of-date') : null);
|
||||
});
|
||||
},
|
||||
], callback);
|
||||
// var all = Upgrade.available.reduce(function (memo, current) {
|
||||
// memo = memo.concat(current.upgrades);
|
||||
// return memo;
|
||||
// }, []);
|
||||
};
|
||||
|
||||
Upgrade.run = function (callback) {
|
||||
@@ -161,7 +157,7 @@ Upgrade.process = function (files, skipCount, callback) {
|
||||
process.stdout.write(' → '.white + String('[' + [date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate()].join('/') + '] ').gray + String(scriptExport.name).reset + '... ');
|
||||
|
||||
// For backwards compatibility, cross-reference with schemaDate (if found). If a script's date is older, skip it
|
||||
if (scriptExport.timestamp <= schemaDate && semver.lt(version, '1.5.0')) {
|
||||
if (!schemaDate || (scriptExport.timestamp <= schemaDate && semver.lt(version, '1.5.0'))) {
|
||||
process.stdout.write('skipped\n'.grey);
|
||||
db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'), next);
|
||||
return;
|
||||
@@ -177,15 +173,15 @@ Upgrade.process = function (files, skipCount, callback) {
|
||||
// Record success in schemaLog
|
||||
db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'), next);
|
||||
});
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
process.stdout.write('Upgrade complete!\n\n'.green);
|
||||
next();
|
||||
});
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
db.set('schemaDate', Date.now(), next);
|
||||
},
|
||||
function (next) {
|
||||
process.stdout.write('Upgrade complete!\n\n'.green);
|
||||
setImmediate(next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user