diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts new file mode 100644 index 0000000000..dc7326f423 --- /dev/null +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts @@ -0,0 +1,28 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class MigrationName1774559064919 implements MigrationInterface { + public name = 'MigrationName1774559064919' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "Dashboard" DROP CONSTRAINT "FK_Dashboard_logoFileId"`); + await queryRunner.query(`ALTER TABLE "Dashboard" DROP CONSTRAINT "FK_Dashboard_faviconFileId"`); + await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`); + await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`); + await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "pageDescription"`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD "pageDescription" character varying(500)`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD CONSTRAINT "FK_2f81cafa1d653e4a023da14e541" FOREIGN KEY ("logoFileId") REFERENCES "File"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD CONSTRAINT "FK_83b237be936983b34fb7bcf1584" FOREIGN KEY ("faviconFileId") REFERENCES "File"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "Dashboard" DROP CONSTRAINT "FK_83b237be936983b34fb7bcf1584"`); + await queryRunner.query(`ALTER TABLE "Dashboard" DROP CONSTRAINT "FK_2f81cafa1d653e4a023da14e541"`); + await queryRunner.query(`ALTER TABLE "Dashboard" DROP COLUMN "pageDescription"`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD "pageDescription" text`); + await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`); + await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD CONSTRAINT "FK_Dashboard_faviconFileId" FOREIGN KEY ("faviconFileId") REFERENCES "File"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "Dashboard" ADD CONSTRAINT "FK_Dashboard_logoFileId" FOREIGN KEY ("logoFileId") REFERENCES "File"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`); + } + +} diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts index 44a2768132..712623c1da 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts @@ -273,6 +273,7 @@ import { MigrationName1774357353502 } from "./1774357353502-MigrationName"; import { MigrationName1774524742177 } from "./1774524742177-MigrationName"; import { MigrationName1774524742178 } from "./1774524742178-MigrationName"; import { MigrationName1774524742179 } from "./1774524742179-MigrationName"; +import { MigrationName1774559064919 } from "./1774559064919-MigrationName"; export default [ InitialMigration, @@ -550,4 +551,5 @@ export default [ MigrationName1774524742177, MigrationName1774524742178, MigrationName1774524742179, + MigrationName1774559064919 ];