-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration file for stratification factor status and remove cascade de…
…lete
- Loading branch information
1 parent
1af3842
commit 0d47107
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
backend/packages/Upgrade/src/database/migrations/1696829429134-stratificationFactorStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`); | ||
} | ||
|
||
} |