diff --git a/apps/server/src/migrations/mikro-orm/Migration20241030126666.ts b/apps/server/src/migrations/mikro-orm/Migration20241030126666.ts new file mode 100644 index 00000000000..ed24789a790 --- /dev/null +++ b/apps/server/src/migrations/mikro-orm/Migration20241030126666.ts @@ -0,0 +1,11 @@ +import { Migration } from '@mikro-orm/migrations-mongodb'; + +export class Migration202410041210124 extends Migration { + async up(): Promise { + await this.getCollection('files').createIndex({ createdAt: 1 }); + } + + async down(): Promise { + // no need + } +} diff --git a/backup/setup/migrations.json b/backup/setup/migrations.json index 9d14285eb33..f748b3a1c23 100644 --- a/backup/setup/migrations.json +++ b/backup/setup/migrations.json @@ -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" + } } ] diff --git a/src/services/fileStorage/model.js b/src/services/fileStorage/model.js index 3098af55f46..54c2f755f43 100644 --- a/src/services/fileStorage/model.js +++ b/src/services/fileStorage/model.js @@ -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);