-
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.
Merge branch 'dev' of https://github.com/CarnegieLearningWeb/UpGrade …
…into feature-flags/merge-typeorm-v0.3-updates
- Loading branch information
Showing
18 changed files
with
143 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
backend/packages/Upgrade/src/database/migrations/1724955378832-fixExposureTable.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,49 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class fixExposureTable1724955378832 implements MigrationInterface { | ||
name = 'fixExposureTable1724955378832'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "FK_6cefc76de0ca7c9a38faae5a8c4"`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "PK_99ab312ceb343f3121eeadb2d50"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "PK_6908f3ead6dd3a6fd4ce38514e6" PRIMARY KEY ("featureFlagId")` | ||
); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_6cefc76de0ca7c9a38faae5a8c"`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP COLUMN "experimentUserId"`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" ADD "experimentUserId" character varying NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "PK_6908f3ead6dd3a6fd4ce38514e6"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "PK_99ab312ceb343f3121eeadb2d50" PRIMARY KEY ("featureFlagId", "experimentUserId")` | ||
); | ||
await queryRunner.query(`ALTER TABLE "experiment" ALTER COLUMN "filterMode" SET DEFAULT 'excludeAll'`); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_6cefc76de0ca7c9a38faae5a8c" ON "feature_flag_exposure" ("experimentUserId") ` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "FK_6cefc76de0ca7c9a38faae5a8c4" FOREIGN KEY ("experimentUserId") REFERENCES "experiment_user"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "FK_6cefc76de0ca7c9a38faae5a8c4"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_6cefc76de0ca7c9a38faae5a8c"`); | ||
await queryRunner.query(`ALTER TABLE "experiment" ALTER COLUMN "filterMode" SET DEFAULT 'includeAll'`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "PK_99ab312ceb343f3121eeadb2d50"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "PK_6908f3ead6dd3a6fd4ce38514e6" PRIMARY KEY ("featureFlagId")` | ||
); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP COLUMN "experimentUserId"`); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" ADD "experimentUserId" uuid NOT NULL`); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_6cefc76de0ca7c9a38faae5a8c" ON "feature_flag_exposure" ("experimentUserId") ` | ||
); | ||
await queryRunner.query(`ALTER TABLE "feature_flag_exposure" DROP CONSTRAINT "PK_6908f3ead6dd3a6fd4ce38514e6"`); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "PK_99ab312ceb343f3121eeadb2d50" PRIMARY KEY ("experimentUserId", "featureFlagId")` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "feature_flag_exposure" ADD CONSTRAINT "FK_6cefc76de0ca7c9a38faae5a8c4" FOREIGN KEY ("experimentUserId") REFERENCES "feature_flag"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.