mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
upgrade.js - categories.numRecentTopics
This commit is contained in:
@@ -14,7 +14,7 @@ var db = require('./database'),
|
||||
|
||||
Upgrade.check = function(callback) {
|
||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
||||
var latestSchema = new Date(2014, 0, 3).getTime();
|
||||
var latestSchema = new Date(2014, 0, 4).getTime();
|
||||
|
||||
db.get('schemaDate', function(err, value) {
|
||||
if (parseInt(value, 10) >= latestSchema) {
|
||||
@@ -132,6 +132,29 @@ Upgrade.upgrade = function(callback) {
|
||||
winston.info('[2014/1/3] categories.class, categories.link fields skipped');
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
// Custom classes for each category, adding link field for each category
|
||||
thisSchemaDate = new Date(2014, 0, 4).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:' + cids[cid], 'numRecentTopics', '2');
|
||||
}
|
||||
|
||||
winston.info('[2013/12/31] Added categories.numRecentTopics fields');
|
||||
next();
|
||||
});
|
||||
} else {
|
||||
winston.info('[2014/1/3] categories.numRecentTopics fields skipped');
|
||||
next();
|
||||
}
|
||||
}
|
||||
// Add new schema updates here
|
||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!
|
||||
|
||||
Reference in New Issue
Block a user