Skip to content

Commit

Permalink
chore: migration to remove redundant indexes (#30918)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Gazzo <[email protected]>
  • Loading branch information
sampaiodiego and ggazzo authored Oct 15, 2024
1 parent 11a47b6 commit 2b84a46
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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 @@ -44,5 +44,6 @@ import './v308';
import './v309';
import './v310';
import './v311';
import './v312';

export * from './xrun';
20 changes: 20 additions & 0 deletions apps/meteor/server/startup/migrations/v312.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { LivechatRooms, Rooms, Subscriptions, Users } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
version: 312,
async up() {
try {
await Promise.allSettled([
LivechatRooms.col.dropIndex('v.token_1'),
Rooms.col.dropIndex('t_1'),
Subscriptions.col.dropIndex('rid_1'),
Users.col.dropIndex('active_1'),
]);
} catch (error: unknown) {
console.warn('Error dropping redundant indexes, continuing...');
console.warn(error);
}
},
});

0 comments on commit 2b84a46

Please sign in to comment.