mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
* chore(server): tidy up exif typeorm entity definition * chore(server): tidy up shared link typeorm entity definition * chore(server): tidy up smart info typeorm entity definition * chore(server): tidy up tag typeorm entity definition * ci: add job that checks typeorm migrations are correct and up-to-date
24 lines
1.8 KiB
TypeScript
24 lines
1.8 KiB
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class SmartInfoEntityDefinitionFixes1676852143506 implements MigrationInterface {
|
|
name = 'SmartInfoEntityDefinitionFixes1676852143506'
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP INDEX "public"."IDX_5e3753aadd956110bf3ec0244a"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" DROP CONSTRAINT "PK_0beace66440e9713f5c40470e46"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" DROP COLUMN "id"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" DROP CONSTRAINT "FK_5e3753aadd956110bf3ec0244ac"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" ADD CONSTRAINT "PK_5e3753aadd956110bf3ec0244ac" PRIMARY KEY ("assetId")`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" ADD CONSTRAINT "FK_5e3753aadd956110bf3ec0244ac" FOREIGN KEY ("assetId") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`ALTER TABLE "smart_info" DROP CONSTRAINT "FK_5e3753aadd956110bf3ec0244ac"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" DROP CONSTRAINT "PK_5e3753aadd956110bf3ec0244ac"`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" ADD CONSTRAINT "FK_5e3753aadd956110bf3ec0244ac" FOREIGN KEY ("assetId") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" ADD "id" SERIAL NOT NULL`);
|
|
await queryRunner.query(`ALTER TABLE "smart_info" ADD CONSTRAINT "PK_0beace66440e9713f5c40470e46" PRIMARY KEY ("id")`);
|
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5e3753aadd956110bf3ec0244a" ON "smart_info" ("assetId") `);
|
|
}
|
|
|
|
}
|