From 25a7cf1a7d6ccc25697e552dac4a1f401e24355e Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:45:09 -0800 Subject: [PATCH] Reverse not null condition UUID --- ...lication-decision-condition-date.entity.ts | 1 - ...f-intent-decision-condition-date.entity.ts | 1 - ..._not_null_condition_date_condition_uuid.ts | 24 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 services/apps/alcs/src/providers/typeorm/migrations/1734457425627-reverse_not_null_condition_date_condition_uuid.ts diff --git a/services/apps/alcs/src/alcs/application-decision/application-decision-condition/application-decision-condition-date/application-decision-condition-date.entity.ts b/services/apps/alcs/src/alcs/application-decision/application-decision-condition/application-decision-condition-date/application-decision-condition-date.entity.ts index f16ccd3da5..2174afbcd0 100644 --- a/services/apps/alcs/src/alcs/application-decision/application-decision-condition/application-decision-condition-date/application-decision-condition-date.entity.ts +++ b/services/apps/alcs/src/alcs/application-decision/application-decision-condition/application-decision-condition-date/application-decision-condition-date.entity.ts @@ -25,7 +25,6 @@ export class ApplicationDecisionConditionDate extends Base { cascade: true, onDelete: 'CASCADE', orphanedRowAction: 'delete', - nullable: false, }) condition: ApplicationDecisionCondition; diff --git a/services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition-date/notice-of-intent-decision-condition-date.entity.ts b/services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition-date/notice-of-intent-decision-condition-date.entity.ts index 7aa7653c74..96542765ac 100644 --- a/services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition-date/notice-of-intent-decision-condition-date.entity.ts +++ b/services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition-date/notice-of-intent-decision-condition-date.entity.ts @@ -25,7 +25,6 @@ export class NoticeOfIntentDecisionConditionDate extends Base { cascade: true, onDelete: 'CASCADE', orphanedRowAction: 'delete', - nullable: false, }) condition: NoticeOfIntentDecisionCondition; diff --git a/services/apps/alcs/src/providers/typeorm/migrations/1734457425627-reverse_not_null_condition_date_condition_uuid.ts b/services/apps/alcs/src/providers/typeorm/migrations/1734457425627-reverse_not_null_condition_date_condition_uuid.ts new file mode 100644 index 0000000000..dc03db1a20 --- /dev/null +++ b/services/apps/alcs/src/providers/typeorm/migrations/1734457425627-reverse_not_null_condition_date_condition_uuid.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ReverseNotNullConditionDateConditionUuid1734457425627 implements MigrationInterface { + name = 'ReverseNotNullConditionDateConditionUuid1734457425627' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" DROP CONSTRAINT "FK_b7a541bf441dc27322bd2acc473"`); + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" ALTER COLUMN "condition_uuid" DROP NOT NULL`); + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" DROP CONSTRAINT "FK_0bd2f73af4ca611761c69769fc2"`); + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" ALTER COLUMN "condition_uuid" DROP NOT NULL`); + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" ADD CONSTRAINT "FK_b7a541bf441dc27322bd2acc473" FOREIGN KEY ("condition_uuid") REFERENCES "alcs"."application_decision_condition"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" ADD CONSTRAINT "FK_0bd2f73af4ca611761c69769fc2" FOREIGN KEY ("condition_uuid") REFERENCES "alcs"."notice_of_intent_decision_condition"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" DROP CONSTRAINT "FK_0bd2f73af4ca611761c69769fc2"`); + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" DROP CONSTRAINT "FK_b7a541bf441dc27322bd2acc473"`); + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" ALTER COLUMN "condition_uuid" SET NOT NULL`); + await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" ADD CONSTRAINT "FK_0bd2f73af4ca611761c69769fc2" FOREIGN KEY ("condition_uuid") REFERENCES "alcs"."notice_of_intent_decision_condition"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" ALTER COLUMN "condition_uuid" SET NOT NULL`); + await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" ADD CONSTRAINT "FK_b7a541bf441dc27322bd2acc473" FOREIGN KEY ("condition_uuid") REFERENCES "alcs"."application_decision_condition"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION`); + } + +}