Skip to content

Commit

Permalink
Merge pull request #2024 from bcgov/feature/ALCS-2312-fix-non-nullabl…
Browse files Browse the repository at this point in the history
…e-date-condition-uuid-error

Reverse not null condition UUID
  • Loading branch information
trslater authored Dec 17, 2024
2 parents dd75e43 + 25a7cf1 commit d1c4b82
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class ApplicationDecisionConditionDate extends Base {
cascade: true,
onDelete: 'CASCADE',
orphanedRowAction: 'delete',
nullable: false,
})
condition: ApplicationDecisionCondition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class NoticeOfIntentDecisionConditionDate extends Base {
cascade: true,
onDelete: 'CASCADE',
orphanedRowAction: 'delete',
nullable: false,
})
condition: NoticeOfIntentDecisionCondition;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class ReverseNotNullConditionDateConditionUuid1734457425627 implements MigrationInterface {
name = 'ReverseNotNullConditionDateConditionUuid1734457425627'

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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`);
}

}

0 comments on commit d1c4b82

Please sign in to comment.