From ec309333be046c9bb559a46c4bc37d99517f5b3e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 31 Oct 2014 13:31:25 -0400 Subject: [PATCH] closed #2335 --- src/upgrade.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 7972247204..80aecf6352 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -19,7 +19,7 @@ var db = require('./database'), schemaDate, thisSchemaDate, // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema - latestSchema = Date.UTC(2014, 9, 22); + latestSchema = Date.UTC(2014, 9, 31); Upgrade.check = function(callback) { db.get('schemaDate', function(err, value) { @@ -1145,7 +1145,29 @@ Upgrade.upgrade = function(callback) { winston.info('[2014/10/22] Topic post count migration skipped'); next(); } + }, + function(next) { + thisSchemaDate = Date.UTC(2014, 9, 31); + if (schemaDate < thisSchemaDate) { + winston.info('[2014/10/31] Applying newbiePostDelay values'); + + async.series([ + async.apply(Meta.configs.setOnEmpty, 'newbiePostDelay', '120'), + async.apply(Meta.configs.setOnEmpty, 'newbiePostDelayThreshold', '3') + ], function(err) { + if (err) { + winston.error('[2014/10/31] Error encountered while Applying newbiePostDelay values'); + return next(err); + } + winston.info('[2014/10/31] Applying newbiePostDelay values done'); + Upgrade.update(thisSchemaDate, next); + }); + } else { + winston.info('[2014/10/31] Applying newbiePostDelay values skipped'); + next(); + } } + // Meta.configs.setOnEmpty = function (field, value, callback) { // Add new schema updates here // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 22!!! ], function(err) {