From 327d65b3e1a96e9f5bebd3333c58e5d0a71abe0c Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Tue, 1 Oct 2024 12:31:21 +0100 Subject: [PATCH] fix: deletedAt not set for offline assets during 1.116.0 migration --- .../1727781844613-IsOfflineSetDeletedAt.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 server/src/migrations/1727781844613-IsOfflineSetDeletedAt.ts diff --git a/server/src/migrations/1727781844613-IsOfflineSetDeletedAt.ts b/server/src/migrations/1727781844613-IsOfflineSetDeletedAt.ts new file mode 100644 index 0000000000000..050e9a93cfb87 --- /dev/null +++ b/server/src/migrations/1727781844613-IsOfflineSetDeletedAt.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class IsOfflineSetDeletedAt1727781844613 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `UPDATE assets SET "deletedAt" = now() WHERE "isOffline" = true AND "deletedAt" IS NULL`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `UPDATE assets SET "deletedAt" = null WHERE "isOffline" = true`, + ); + } +}