From 4af8433aad39701efb8390e6bde48f79195baed1 Mon Sep 17 00:00:00 2001 From: PyKen Date: Tue, 3 Sep 2024 13:19:15 +0900 Subject: [PATCH] fix(server): remove thumbnailAt in asset_job_status for missing thumbnails (#12254) * Remove thumbnailAt in asset_job_status for missing thumbnails * fix linter error --- ...27902980-RemoveThumbailAtForMissingThumbnails.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 server/src/migrations/1725327902980-RemoveThumbailAtForMissingThumbnails.ts diff --git a/server/src/migrations/1725327902980-RemoveThumbailAtForMissingThumbnails.ts b/server/src/migrations/1725327902980-RemoveThumbailAtForMissingThumbnails.ts new file mode 100644 index 0000000000..a63f281da7 --- /dev/null +++ b/server/src/migrations/1725327902980-RemoveThumbailAtForMissingThumbnails.ts @@ -0,0 +1,13 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class RemoveThumbailAtForMissingThumbnails1725327902980 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`UPDATE "asset_job_status" j SET "thumbnailAt" = NULL WHERE j."thumbnailAt" IS NOT NULL AND NOT EXISTS ( SELECT 1 FROM public.asset_files f WHERE j."assetId" = f."assetId" AND f."type" = 'thumbnail' AND f."path" IS NOT NULL )`); + } + + public async down(): Promise { + // do nothing + } + +}