diff --git a/apps/server/src/migrations/mikro-orm/Migration20240612122202.ts b/apps/server/src/migrations/mikro-orm/Migration20240612122202.ts new file mode 100644 index 00000000000..fa302afb207 --- /dev/null +++ b/apps/server/src/migrations/mikro-orm/Migration20240612122202.ts @@ -0,0 +1,15 @@ +import { Migration } from '@mikro-orm/migrations-mongodb'; + +export class Migration20240612122202 extends Migration { + async up(): Promise { + const filerecords = await this.driver.nativeUpdate('filerecords', {}, { $rename: { school: 'storageLocationId' } }); + + console.info(`${filerecords.affectedRows} Filerecords were migrated to "storageLocationId"`); + } + + async down(): Promise { + const filerecords = await this.driver.nativeUpdate('filerecords', {}, { $rename: { storageLocationId: 'school' } }); + + console.info(`${filerecords.affectedRows} Filerecords were rolled back to use "schoolId"`); + } +}