mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
19 lines
1.2 KiB
TypeScript
19 lines
1.2 KiB
TypeScript
|
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||
|
|
|
||
|
|
export class FixLivePhotoVideoRelation1719359859887 implements MigrationInterface {
|
||
|
|
name = 'FixLivePhotoVideoRelation1719359859887'
|
||
|
|
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" DROP CONSTRAINT "FK_16294b83fa8c0149719a1f631ef"`);
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" DROP CONSTRAINT "UQ_16294b83fa8c0149719a1f631ef"`);
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" ADD CONSTRAINT "FK_16294b83fa8c0149719a1f631ef" FOREIGN KEY ("livePhotoVideoId") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE`);
|
||
|
|
}
|
||
|
|
|
||
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" DROP CONSTRAINT "FK_16294b83fa8c0149719a1f631ef"`);
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" ADD CONSTRAINT "UQ_16294b83fa8c0149719a1f631ef" UNIQUE ("livePhotoVideoId")`);
|
||
|
|
await queryRunner.query(`ALTER TABLE "assets" ADD CONSTRAINT "FK_16294b83fa8c0149719a1f631ef" FOREIGN KEY ("livePhotoVideoId") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE`);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|