The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/startup/migrations/v077.js

28 lines
567 B

import { Migrations } from '../../../app/migrations';
import { Rooms, Users } from '../../../app/models';
Migrations.add({
version: 77,
up() {
if (Rooms) {
Rooms.find({
t: 'l',
'v._id': { $exists: true },
'v.username': { $exists: false },
}, { fields: { 'v._id': 1 } }).forEach(function(room) {
const user = Users.findOne({ _id: room.v._id }, { username: 1 });
if (user && user.username) {
Rooms.update({
_id: room._id,
}, {
$set: {
'v.username': user.username,
},
});
}
});
}
},
});