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

20 lines
575 B

import { Migrations } from '../../../app/migrations/server';
import { LivechatRooms, LivechatInquiry } from '../../../app/models/server';
Migrations.add({
version: 180,
up() {
// Remove Old Omnichannel Inquiries related to rooms already closed
LivechatInquiry.find().forEach((inquiry) => {
const { rid, status } = inquiry;
if (status === 'closed') {
return LivechatInquiry.removeByRoomId(rid);
}
const room = LivechatRooms.findOneById(rid, { closedAt: 1 });
if (!room || room.closedAt) {
LivechatInquiry.removeByRoomId(rid);
}
});
},
});