-
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.
Added dev branch remaining migration changes (#983)
Co-authored-by: RidhamShah <[email protected]>
- Loading branch information
1 parent
9a79b8e
commit 98ae618
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
backend/packages/Upgrade/src/database/migrations/1692792001871-remainingDevMigrations.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,35 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class remainingDevMigrations1692792001871 implements MigrationInterface { | ||
name = 'remainingDevMigrations1692792001871'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TYPE "public"."query_repeatedmeasure_enum" RENAME TO "query_repeatedmeasure_enum_old"` | ||
); | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."query_repeatedmeasure_enum" AS ENUM('MEAN', 'EARLIEST', 'MOST RECENT', 'COUNT', 'PERCENTAGE')` | ||
); | ||
await queryRunner.query(`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" DROP DEFAULT`); | ||
await queryRunner.query( | ||
`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" TYPE "public"."query_repeatedmeasure_enum" USING "repeatedMeasure"::"text"::"public"."query_repeatedmeasure_enum"` | ||
); | ||
await queryRunner.query(`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" SET DEFAULT 'MOST RECENT'`); | ||
await queryRunner.query(`DROP TYPE "public"."query_repeatedmeasure_enum_old"`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."query_repeatedmeasure_enum_old" AS ENUM('EARLIEST', 'MEAN', 'MOST RECENT')` | ||
); | ||
await queryRunner.query(`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" DROP DEFAULT`); | ||
await queryRunner.query( | ||
`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" TYPE "public"."query_repeatedmeasure_enum_old" USING "repeatedMeasure"::"text"::"public"."query_repeatedmeasure_enum_old"` | ||
); | ||
await queryRunner.query(`ALTER TABLE "public"."query" ALTER COLUMN "repeatedMeasure" SET DEFAULT 'MOST RECENT'`); | ||
await queryRunner.query(`DROP TYPE "public"."query_repeatedmeasure_enum"`); | ||
await queryRunner.query( | ||
`ALTER TYPE "public"."query_repeatedmeasure_enum_old" RENAME TO "query_repeatedmeasure_enum"` | ||
); | ||
} | ||
} |