|
|
@ -14,7 +14,7 @@ var db = require('./database'),
|
|
|
|
|
|
|
|
|
|
|
|
Upgrade.check = function(callback) {
|
|
|
|
Upgrade.check = function(callback) {
|
|
|
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
|
|
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
|
|
|
var latestSchema = new Date(2014, 0, 1).getTime();
|
|
|
|
var latestSchema = new Date(2014, 0, 3).getTime();
|
|
|
|
|
|
|
|
|
|
|
|
db.get('schemaDate', function(err, value) {
|
|
|
|
db.get('schemaDate', function(err, value) {
|
|
|
|
if (parseInt(value, 10) >= latestSchema) {
|
|
|
|
if (parseInt(value, 10) >= latestSchema) {
|
|
|
@ -108,6 +108,30 @@ Upgrade.upgrade = function(callback) {
|
|
|
|
winston.info('[2013/12/31] maximumTitleLength skipped');
|
|
|
|
winston.info('[2013/12/31] maximumTitleLength skipped');
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
function(next) {
|
|
|
|
|
|
|
|
// Custom classes for each category, adding link field for each category
|
|
|
|
|
|
|
|
thisSchemaDate = new Date(2014, 0, 3).getTime();
|
|
|
|
|
|
|
|
if (schemaDate < thisSchemaDate) {
|
|
|
|
|
|
|
|
updatesMade = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.getListRange('categories:cid', 0, -1, function(err, cids) {
|
|
|
|
|
|
|
|
if(err) {
|
|
|
|
|
|
|
|
return next(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var cid in cids) {
|
|
|
|
|
|
|
|
db.setObjectField('category:' + cid, 'link', '');
|
|
|
|
|
|
|
|
db.setObjectField('category:' + cid, 'class', 'col-md-3 col-xs-6');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
winston.info('[2013/12/31] Added categories.class, categories.link fields');
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
winston.info('[2014/1/3] categories.class, categories.link fields skipped');
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Add new schema updates here
|
|
|
|
// Add new schema updates here
|
|
|
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!
|
|
|
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!
|
|
|
|