From ee6ac77f8b740fea75cb96fd987c6b780411f214 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 19 Jan 2014 22:29:28 -0500 Subject: [PATCH] new upgrade directive --- src/upgrade.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 89f3843192..15d8613272 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -17,7 +17,7 @@ var db = require('./database'), Upgrade.check = function(callback) { // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema - var latestSchema = new Date(2014, 0, 13, 12, 0).getTime(); + var latestSchema = new Date(2014, 0, 19, 22, 19).getTime(); db.get('schemaDate', function(err, value) { if (parseInt(value, 10) >= latestSchema) { @@ -281,6 +281,24 @@ Upgrade.upgrade = function(callback) { winston.info('[2014/1/13] Set up "Registered Users" user group - skipped'); next(); } + }, + function(next) { + thisSchemaDate = new Date(2014, 0, 19, 22, 19).getTime(); + if (schemaDate < thisSchemaDate) { + updatesMade = true; + + db.getObjectValues('username:uid', function(err, uids) { + async.each(uids, function(uid, next) { + db.searchRemove('user', uid, next); + }, function(err) { + winston.info('[2014/1/19] Remove user search from Reds'); + next(); + }); + }); + } else { + winston.info('[2014/1/19] Remove user search from Reds -- skipped'); + next(); + } } // Add new schema updates here // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!