Skip to content

Commit

Permalink
Reverse not null condition UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
trslater committed Dec 17, 2024
1 parent dd75e43 commit 25a7cf1
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 25a7cf1

Please sign in to comment.