This commit is contained in:
Calvin Montgomery 2014-06-11 08:56:06 -07:00
parent f75ffe089c
commit b71d3610f2
2 changed files with 5 additions and 2 deletions

View File

@ -124,6 +124,7 @@ module.exports.createChannelTables = function (name, queryfn, cb) {
"`title` VARCHAR(255) NOT NULL," +
"`seconds` INT NOT NULL," +
"`type` VARCHAR(2) NOT NULL," +
//"`meta` TEXT NOT NULL," +
"PRIMARY KEY (`id`))" +
"CHARACTER SET utf8", createBansTable);
};

View File

@ -2,7 +2,8 @@ var db = require("../database");
var Logger = require("../logger");
var Q = require("q");
const DB_VERSION = 2;
const DB_VERSION = 3;
var hasUpdates = [];
module.exports.checkVersion = function () {
db.query("SELECT `key`,`value` FROM `meta` WHERE `key`=?", ["db_version"], function (err, rows) {
@ -23,6 +24,7 @@ module.exports.checkVersion = function () {
return;
}
var next = function () {
hasUpdates.push(v);
if (v < DB_VERSION) {
update(v++, next);
} else {
@ -36,7 +38,7 @@ module.exports.checkVersion = function () {
};
function update(version, cb) {
if (version === 1) {
if (version < 3 && hasUpdates.indexOf(2) < 0) {
addMetaColumnToLibraries(cb);
}
}