tweaking upgrade script

v1.18.x
Julian Lam 11 years ago
parent 3f0f5a09a0
commit 4923c79496

@ -209,11 +209,13 @@ Upgrade.upgrade = function(callback) {
}
},
function(next) {
thisSchemaDate = new Date(2014, 0, 5, 14, 5).getTime();
thisSchemaDate = new Date(2014, 0, 5, 14, 6).getTime();
if (schemaDate < thisSchemaDate) {
updatesMade = true;
// Re-slugify all users
db.delete('userslug:uid', function(err) {
if (!err) {
db.getObjectValues('username:uid', function(err, uids) {
var newUserSlug;
@ -224,7 +226,14 @@ Upgrade.upgrade = function(callback) {
}
if(username) {
newUserSlug = Utils.slugify(username);
async.parallel([
function(next) {
User.setUserField(uid, 'userslug', newUserSlug, next);
},
function(next) {
db.setObjectField('userslug:uid', newUserSlug, uid, next);
}
], next);
} else {
winston.warn('uid '+ uid + ' doesn\'t have a valid username (' + username + '), skipping');
next(null);
@ -235,6 +244,8 @@ Upgrade.upgrade = function(callback) {
next(err);
});
});
}
})
} else {
winston.info('[2014/1/5] Re-slugify usernames (again) skipped');
next();

Loading…
Cancel
Save