mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
flushed out upgrade path for notifications
This commit is contained in:
@@ -11,6 +11,21 @@ Upgrade.upgrade = function() {
|
||||
function(next) {
|
||||
RDB.hget('notifications:1', 'score', function(err, score) {
|
||||
if (score) {
|
||||
async.series([
|
||||
function(next) {
|
||||
RDB.keys('uid:*:notifications:flag', function(err, keys) {
|
||||
if (keys.length > 0) {
|
||||
winston.info('[2013/10/03] Removing deprecated Notification Flags');
|
||||
async.each(keys, function(key, next) {
|
||||
RDB.del(key, next);
|
||||
}, next);
|
||||
} else {
|
||||
winston.info('[2013/10/03] No Notification Flags found. Good.');
|
||||
next();
|
||||
}
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
winston.info('[2013/10/03] Updating Notifications');
|
||||
RDB.keys('uid:*:notifications:*', function(err, keys) {
|
||||
async.each(keys, function(key, next) {
|
||||
@@ -23,8 +38,25 @@ Upgrade.upgrade = function() {
|
||||
});
|
||||
}, next);
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
RDB.keys('notifications:*', function(err, keys) {
|
||||
if (keys.length > 0) {
|
||||
winston.info('[2013/10/03] Removing Notification Scores');
|
||||
async.each(keys, function(key, next) {
|
||||
if (key === 'notifications:next_nid') return next();
|
||||
RDB.hdel(key, 'score', next);
|
||||
}, next);
|
||||
} else {
|
||||
winston.info('[2013/10/03] No Notification Scores found. Good.');
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
], next);
|
||||
} else {
|
||||
winston.info('[2013/10/03] Updates to Notifications skipped.');
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user