mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix: storage template failure after re-upload and previous fail (#16611)
fix: storage template breaks when files are re-uploaded after a move failure
This commit is contained in:
parent
3f4bbab4eb
commit
9922c8de59
6 changed files with 81 additions and 3 deletions
|
|
@ -0,0 +1,26 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class MoveHistoryUuidEntityId1741179334403 implements MigrationInterface {
|
||||
name = 'MoveHistoryUuidEntityId1741179334403';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "move_history" ALTER COLUMN "entityId" TYPE uuid USING "entityId"::uuid;`);
|
||||
await queryRunner.query(`delete from "move_history"
|
||||
where
|
||||
"move_history"."entityId" not in (
|
||||
select
|
||||
"id"
|
||||
from
|
||||
"assets"
|
||||
where
|
||||
"assets"."id" = "move_history"."entityId"
|
||||
)
|
||||
and "move_history"."pathType" = 'original'
|
||||
`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "move_history" ALTER COLUMN "entityId" TYPE character varying`);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue