mirror of https://github.com/calzoneman/sync.git
Fix #374
This commit is contained in:
parent
f75ffe089c
commit
b71d3610f2
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue