Skip to content

Node.js based forum software built for the modern web

fix logic error that caused upgrade scripts to always be skipped

Julian Lamce64db8d7158
diff --git a/src/upgrade.js b/src/upgrade.js
index 57f40f5fa7..2cf75db145 100644
--- a/src/upgrade.js
+++ b/src/upgrade.js
@@ -153,16 +153,15 @@ Upgrade.process = function (files, skipCount, callback) {
async.waterfall([
async.apply(db.get, 'schemaDate'),
function (schemaDate, next) {
- var schemaTime = new Date(schemaDate);
-
async.eachSeries(files, function (file, next) {
var scriptExport = require(file);
var date = new Date(scriptExport.timestamp);
+ var version = path.dirname(file).split('/').pop();
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 <= schemaTime) {
+ if (scriptExport.timestamp <= schemaDate && semver.lt(version, '1.5.0')) {
process.stdout.write('skipped\n'.grey);
db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'));
return next();