Skip to content

Commit

Permalink
BC-8339 create index on files.createdAt (#5320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loki-Afro authored Oct 30, 2024
1 parent 733ceca commit 59d5d37
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/server/src/migrations/mikro-orm/Migration20241030126666.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Migration } from '@mikro-orm/migrations-mongodb';

export class Migration202410041210124 extends Migration {
async up(): Promise<void> {
await this.getCollection('files').createIndex({ createdAt: 1 });
}

async down(): Promise<void> {
// no need
}
}
9 changes: 9 additions & 0 deletions backup/setup/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,14 @@
"created_at": {
"$date": "2024-10-23T09:54:49.077Z"
}
},
{
"_id": {
"$oid": "672266e39dcc983d3b724d5d"
},
"name": "Migration20241030126666",
"created_at": {
"$date": "2024-10-30T17:03:31.473Z"
}
}
]
1 change: 1 addition & 0 deletions src/services/fileStorage/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ fileSchema.index({ 'permissions.refId': 1, 'permissions.refPermModel': 1 }); //
// Speed up directory listings
fileSchema.index({ owner: 1, parent: 1 }); // ?
fileSchema.index({ 'securityCheck.requestToken': 1 }); // ?
fileSchema.index({ createdAt: 1 });

const FileModel = mongoose.model('file', fileSchema);
const FilePermissionModel = mongoose.model('filePermissionModel', permissionSchema);
Expand Down

0 comments on commit 59d5d37

Please sign in to comment.