Add calendar field metadata id to view table (#14478)

This commit is contained in:
Weiko
2025-09-15 09:17:17 +02:00
committed by GitHub
parent 3b0aba77ac
commit eada8e2567
19 changed files with 249 additions and 24 deletions
@@ -0,0 +1,31 @@
import { type MigrationInterface, type QueryRunner } from 'typeorm';
export class AddCalendarFieldMetadataIdToViewTable1757864696439
implements MigrationInterface
{
name = 'AddCalendarFieldMetadataIdToViewTable1757864696439';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."view" DROP CONSTRAINT "CHK_VIEW_CALENDAR_LAYOUT_NOT_NULL_WHEN_TYPE_CALENDAR"`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" ADD "calendarFieldMetadataId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" ADD CONSTRAINT "CHK_VIEW_CALENDAR_INTEGRITY" CHECK (("type" != 'CALENDAR' OR ("calendarLayout" IS NOT NULL AND "calendarFieldMetadataId" IS NOT NULL)))`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."view" DROP CONSTRAINT "CHK_VIEW_CALENDAR_INTEGRITY"`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" DROP COLUMN "calendarFieldMetadataId"`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" ADD CONSTRAINT "CHK_VIEW_CALENDAR_LAYOUT_NOT_NULL_WHEN_TYPE_CALENDAR" CHECK (((type <> 'CALENDAR'::core.view_type_enum) OR ("calendarLayout" IS NOT NULL)))`,
);
}
}