Skip to content
2 changes: 1 addition & 1 deletion app/models/server/models/apps-persistence-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AppsPersistenceModel extends Base {
constructor() {
super('apps_persistence');

this.tryEnsureIndex({ appId: 1 });
this.tryEnsureIndex({ appId: 1, associations: 1 });
}

// Bypass trash collection
Expand Down
1 change: 1 addition & 0 deletions server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ import './v244';
import './v245';
import './v246';
import './v247';
import './v248';
import './xrun';
12 changes: 12 additions & 0 deletions server/startup/migrations/v248.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { addMigration } from '../../lib/migrations';
import { Apps } from '../../../app/apps/server/orchestrator';

addMigration({
version: 248,
up() {
// we now have a compound index on appId + associations
// so we can use the index prefix instead of a separate index on appId
Apps.initialize();
return Apps._persistModel?.tryDropIndex({ appId: 1 });
},
});