Skip to content

Commit

Permalink
Fix migration 77. Closes #5542
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Jan 13, 2017
1 parent d93efa6 commit e199215
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions server/startup/migrations/v077.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ RocketChat.Migrations.add({
}, { fields: { 'v._id': 1 } }).forEach(function(room) {
const user = RocketChat.models.Users.findOne({ _id: room.v._id }, { username: 1 });

RocketChat.models.Rooms.update({
_id: room._id
}, {
$set: {
'v.username': user.username
}
});
if (user && user.username) {
RocketChat.models.Rooms.update({
_id: room._id
}, {
$set: {
'v.username': user.username
}
});
}
});
}
}
Expand Down

0 comments on commit e199215

Please sign in to comment.