mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 02:20:49 +01:00
added checks to skip empty/non-existing hashes
This commit is contained in:
@@ -967,14 +967,18 @@ Upgrade.upgrade = function(callback) {
|
||||
function(next) {
|
||||
function upgradeHashToSortedSet(hash, callback) {
|
||||
db.getObject(hash, function(err, oldHash) {
|
||||
if (err) {
|
||||
if (err || !oldHash) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
db.rename(hash, hash + '_old', function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var keys = Object.keys(oldHash);
|
||||
if (!keys.length) {
|
||||
return callback();
|
||||
}
|
||||
async.each(keys, function(key, next) {
|
||||
db.sortedSetAdd(hash, oldHash[key], key, next);
|
||||
}, callback);
|
||||
|
||||
Reference in New Issue
Block a user