install db dependencies in upgrade script

v1.18.x
barisusakli 11 years ago
parent d565de60d0
commit 5c57ed5ea0

@ -206,6 +206,16 @@ function completeConfigSetup(err, config, next) {
}
function setupDatabase(server_conf, next) {
install.installDbDependencies(server_conf, function(err) {
if (err) {
return next(err);
}
require('./database').init(next);
});
}
install.installDbDependencies = function(server_conf, next) {
var npm = require('npm'),
packages = [];
@ -221,15 +231,9 @@ function setupDatabase(server_conf, next) {
packages = packages.concat(DATABASES[server_conf.secondary_database].dependencies);
}
npm.commands.install(packages, function(err) {
if (err) {
return next(err);
}
require('./database').init(next);
});
npm.commands.install(packages, next);
});
}
};
function setupDefaultConfigs(next) {
winston.info('Populating database with default configs, if not already set...');

@ -19,7 +19,7 @@ var db = require('./database'),
schemaDate, thisSchemaDate,
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
latestSchema = Date.UTC(2014, 5, 17);
latestSchema = Date.UTC(2014, 6, 23);
Upgrade.check = function(callback) {
db.get('schemaDate', function(err, value) {
@ -861,6 +861,26 @@ Upgrade.upgrade = function(callback) {
winston.info('[2014/6/17] Category post count upgrade - skipped');
next();
}
},
function(next) {
thisSchemaDate = Date.UTC(2014, 6, 23);
if (schemaDate < thisSchemaDate) {
winston.info('[2014/7/23] Upgrading db dependencies...');
var install = require('./install');
var config = require('../config.json');
install.installDbDependencies(config, function(err) {
if (err) {
winston.error('[2014/7/23] Error encountered while upgrading db dependencies');
return next(err);
}
winston.error('[2014/7/23] Upgraded db dependencies');
Upgrade.update(thisSchemaDate, next);
});
} else {
winston.info('[2014/7/23] Upgrading db dependencies - skipped');
next();
}
}
// Add new schema updates here
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 22!!!

Loading…
Cancel
Save