diff --git a/src/install.js b/src/install.js index 8ce2a059ed..9920a1b9b2 100644 --- a/src/install.js +++ b/src/install.js @@ -253,6 +253,11 @@ var async = require('async'), } }); }, next); + }, + function (next) { + // Upgrading schema + var Upgrade = require('./upgrade'); + Upgrade.upgrade(next); } ], function (err) { if (err) { @@ -328,7 +333,7 @@ var async = require('async'), if (!results) { return callback(new Error('aborted')); } - + // Update the original data with newly collected password originalResults.password = results.password; originalResults['password:confirm'] = results['password:confirm']; diff --git a/src/upgrade.js b/src/upgrade.js index 26ac52cc19..47d9fffc98 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -20,7 +20,7 @@ Upgrade.check = function(callback) { }); }; -Upgrade.upgrade = function() { +Upgrade.upgrade = function(callback) { winston.info('Beginning Redis database schema update'); async.series([ @@ -136,13 +136,19 @@ Upgrade.upgrade = function() { RDB.set('schemaDate', thisSchemaDate, function(err) { if (!err) { winston.info('[upgrade] Redis schema update complete!'); - process.exit(); + if (callback) { + callback(err); + } else { + process.exit(); + } } else { winston.error('[upgrade] Could not update NodeBB schema date!'); + process.exit(); } }); } else { winston.error('[upgrade] Errors were encountered while updating the NodeBB schema: ' + err.message); + process.exit(); } }); };