Skip to content

Commit

Permalink
chore: migration to remove redundant indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored and ggazzo committed Oct 15, 2024
1 parent 204272c commit e169558
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 @@ -43,5 +43,6 @@ import './v307';
import './v308';
import './v309';
import './v310';
import './v311';

export * from './xrun';
20 changes: 20 additions & 0 deletions apps/meteor/server/startup/migrations/v311.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: 311,
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 e169558

Please sign in to comment.