mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
added updateUserNames migration to convert usernames to lowercase
This commit is contained in:
parent
31ce925b70
commit
d50e61a248
1 changed files with 23 additions and 0 deletions
|
@ -120,6 +120,29 @@ var migrationsList = {
|
|||
});
|
||||
return i;
|
||||
},
|
||||
updateUserNames: function () {
|
||||
var i = 0;
|
||||
var allUsers = Meteor.users.find();
|
||||
console.log('> Found '+allUsers.count()+' users.\n');
|
||||
|
||||
allUsers.forEach(function(user){
|
||||
i++;
|
||||
console.log('> Updating user '+user._id+' ('+user.username+' -> ' + user.username.toLowerCase() + ')');
|
||||
|
||||
try {
|
||||
Meteor.users.update(user._id, {
|
||||
$set: {
|
||||
username: user.username.toLowerCase()
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
console.warn('> Unable to convert username ' + user.username + ' to lowercase!');
|
||||
console.warn('> Please try to fix it by hands!! :(');
|
||||
}
|
||||
});
|
||||
return i;
|
||||
},
|
||||
updateUserProfiles: function () {
|
||||
var i = 0;
|
||||
var allUsers = Meteor.users.find();
|
||||
|
|
Loading…
Add table
Reference in a new issue