Fix updater

This commit is contained in:
Calvin Montgomery 2014-06-24 20:28:04 -07:00
parent 36c4e41131
commit f44c9ce51b

View file

@ -25,8 +25,10 @@ module.exports.checkVersion = function () {
}
var next = function () {
hasUpdates.push(v);
Logger.syslog.log("Updated database to version " + v);
if (v < DB_VERSION) {
update(v++, next); } else {
update(v++, next);
} else {
db.query("UPDATE `meta` SET `value`=? WHERE `key`='db_version'",
[DB_VERSION]);
}
@ -40,14 +42,15 @@ function update(version, cb) {
if (version < 3 && hasUpdates.indexOf(2) < 0) {
addMetaColumnToLibraries(cb);
} else if (version < 4) {
Q.all([
Q.fcall(mergeChannelLibraries),
Q.fcall(mergeChannelRanks),
Q.fcall(mergeChannelBans)
Q.allSettled([
Q.nfcall(mergeChannelLibraries),
Q.nfcall(mergeChannelRanks),
Q.nfcall(mergeChannelBans)
]).done(function () {
Logger.syslog.log("Merged channel tables. Please verify that everything " +
"is working correctly, and then type '/delete_old_tables'" +
" into the CyTube process to remove the unused tables.");
cb();
})
}
}
@ -111,7 +114,7 @@ function mergeChannelLibraries(cb) {
if (err.stack) {
Logger.errlog.log(err.stack);
}
}).done(cb);
}).done(function () { cb(null); });
}
function mergeChannelRanks(cb) {
@ -147,7 +150,7 @@ function mergeChannelRanks(cb) {
if (err.stack) {
Logger.errlog.log(err.stack);
}
}).done(cb);
}).done(function () { cb(null); });
}
function mergeChannelBans(cb) {
@ -183,7 +186,7 @@ function mergeChannelBans(cb) {
if (err.stack) {
Logger.errlog.log(err.stack);
}
}).done(cb);
}).done(function () { cb(null); });
}
module.exports.deleteOldChannelTables = function (cb) {