diff --git a/lib/database/tables.js b/lib/database/tables.js index 759bcc2d..48db4d8a 100644 --- a/lib/database/tables.js +++ b/lib/database/tables.js @@ -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); }; diff --git a/lib/database/update.js b/lib/database/update.js index 8db7b092..386694d1 100644 --- a/lib/database/update.js +++ b/lib/database/update.js @@ -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); } }