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/v006.js

43 lines
698 B

RocketChat.Migrations.add({
version: 6,
up() {
console.log('Changing _id of #general channel room from XXX to GENERAL');
const room = RocketChat.models.Rooms.findOneByName('general');
if (room && room._id !== 'GENERAL') {
RocketChat.models.Subscriptions.update({
rid: room._id
}, {
$set: {
rid: 'GENERAL'
}
}, {
multi: 1
});
RocketChat.models.Messages.update({
rid: room._id
}, {
$set: {
rid: 'GENERAL'
}
}, {
multi: 1
});
RocketChat.models.Rooms.removeById(room._id);
delete room._id;
RocketChat.models.Rooms.upsert({
_id: 'GENERAL'
}, {
$set: room
});
}
return console.log('End');
}
});