Skip to content

Commit

Permalink
migration file for stratification factor status and remove cascade de…
Browse files Browse the repository at this point in the history
…lete
  • Loading branch information
ppratikcr7 committed Oct 9, 2023
1 parent 1af3842 commit 0d47107
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {MigrationInterface, QueryRunner} from "typeorm";

export class stratificationFactorStatus1696829429134 implements MigrationInterface {
name = 'stratificationFactorStatus1696829429134'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "public"."user_stratification_factor" DROP CONSTRAINT "FK_a314482a152dd63f49898feb468"`);
await queryRunner.query(`ALTER TABLE "public"."experiment" DROP CONSTRAINT "FK_335189d91114f3a71ff18be6243"`);
await queryRunner.query(`ALTER TABLE "public"."user_stratification_factor" ADD CONSTRAINT "FK_a314482a152dd63f49898feb468" FOREIGN KEY ("userId") REFERENCES "experiment_user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "public"."experiment" ADD CONSTRAINT "FK_335189d91114f3a71ff18be6243" FOREIGN KEY ("stratificationFactorStratificationFactorName") REFERENCES "stratification_factor"("stratificationFactorName") ON DELETE NO ACTION ON UPDATE NO ACTION`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "public"."experiment" DROP CONSTRAINT "FK_335189d91114f3a71ff18be6243"`);
await queryRunner.query(`ALTER TABLE "public"."user_stratification_factor" DROP CONSTRAINT "FK_a314482a152dd63f49898feb468"`);
await queryRunner.query(`ALTER TABLE "public"."experiment" ADD CONSTRAINT "FK_335189d91114f3a71ff18be6243" FOREIGN KEY ("stratificationFactorStratificationFactorName") REFERENCES "stratification_factor"("stratificationFactorName") ON DELETE CASCADE ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "public"."user_stratification_factor" ADD CONSTRAINT "FK_a314482a152dd63f49898feb468" FOREIGN KEY ("userId") REFERENCES "experiment_user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
}

}

0 comments on commit 0d47107

Please sign in to comment.