Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dev branch remaining migration changes #983

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
);
}
}