mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): track thumbnail jobs in job status table (#11908)
refactor: track thumbnail jobs in job status table
This commit is contained in:
parent
8338657eaa
commit
d9698884bd
4 changed files with 49 additions and 9 deletions
17
server/src/migrations/1724080823160-AddThumbnailJobStatus.ts
Normal file
17
server/src/migrations/1724080823160-AddThumbnailJobStatus.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddThumbnailJobStatus1724080823160 implements MigrationInterface {
|
||||
name = 'AddThumbnailJobStatus1724080823160';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" ADD "previewAt" TIMESTAMP WITH TIME ZONE`);
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" ADD "thumbnailAt" TIMESTAMP WITH TIME ZONE`);
|
||||
await queryRunner.query(`UPDATE "asset_job_status" SET "previewAt" = NOW() FROM "assets" WHERE "assetId" = "assets"."id" AND "assets"."previewPath" IS NOT NULL`);
|
||||
await queryRunner.query(`UPDATE "asset_job_status" SET "thumbnailAt" = NOW() FROM "assets" WHERE "assetId" = "assets"."id" AND "assets"."thumbnailPath" IS NOT NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" DROP COLUMN "thumbnailAt"`);
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" DROP COLUMN "previewAt"`);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue