Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/meteor/server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ import './v332';
import './v333';
import './v334';
import './v335';
import './v336';

export * from './xrun';
24 changes: 24 additions & 0 deletions apps/meteor/server/startup/migrations/v336.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { addMigration } from '../../lib/migrations';
import { getRawCollection } from '@rocket.chat/models';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

addMigration({
version: 336,
name: 'Drop legacy unique index from read_receipts',
async up() {
const collection = getRawCollection('read_receipts');

const indexes = await collection.indexes();

const targetIndex = indexes.find((idx) => {
return (
idx.key?.roomId === 1 &&
idx.key?.userId === 1 &&
idx.key?.messageId === 1
);
});

if (targetIndex) {
await collection.dropIndex(targetIndex.name);
}
},
});