This commit is contained in:
Julian Lam
2013-11-21 17:41:27 -05:00
parent 4aef5bfb72
commit 08e51c8942
2 changed files with 14 additions and 3 deletions

View File

@@ -253,6 +253,11 @@ var async = require('async'),
} }
}); });
}, next); }, next);
},
function (next) {
// Upgrading schema
var Upgrade = require('./upgrade');
Upgrade.upgrade(next);
} }
], function (err) { ], function (err) {
if (err) { if (err) {

View File

@@ -20,7 +20,7 @@ Upgrade.check = function(callback) {
}); });
}; };
Upgrade.upgrade = function() { Upgrade.upgrade = function(callback) {
winston.info('Beginning Redis database schema update'); winston.info('Beginning Redis database schema update');
async.series([ async.series([
@@ -136,13 +136,19 @@ Upgrade.upgrade = function() {
RDB.set('schemaDate', thisSchemaDate, function(err) { RDB.set('schemaDate', thisSchemaDate, function(err) {
if (!err) { if (!err) {
winston.info('[upgrade] Redis schema update complete!'); winston.info('[upgrade] Redis schema update complete!');
if (callback) {
callback(err);
} else {
process.exit(); process.exit();
}
} else { } else {
winston.error('[upgrade] Could not update NodeBB schema date!'); winston.error('[upgrade] Could not update NodeBB schema date!');
process.exit();
} }
}); });
} else { } else {
winston.error('[upgrade] Errors were encountered while updating the NodeBB schema: ' + err.message); winston.error('[upgrade] Errors were encountered while updating the NodeBB schema: ' + err.message);
process.exit();
} }
}); });
}; };