-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1676389662380-NewIssuerSelection.ts
20 lines (16 loc) · 1.15 KB
/
1676389662380-NewIssuerSelection.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { MigrationInterface, QueryRunner } from "typeorm";
export class NewIssuerSelection1676389662380 implements MigrationInterface {
name = 'NewIssuerSelection1676389662380'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "vtp_selection" ADD "issuer" character varying`);
await queryRunner.query(`UPDATE "vtp_selection" SET "issuer" = "vtp_loc_id"`);
await queryRunner.query(`ALTER TABLE "vtp_selection" ALTER COLUMN "issuer" SET NOT NULL`);
await queryRunner.query(`ALTER TABLE "vtp_selection" DROP CONSTRAINT "PK_vtp_selection"`);
await queryRunner.query(`ALTER TABLE "vtp_selection" ADD CONSTRAINT "PK_vtp_selection" PRIMARY KEY ("loc_request_id", "issuer")`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "vtp_selection" DROP CONSTRAINT "PK_vtp_selection"`);
await queryRunner.query(`ALTER TABLE "vtp_selection" ADD CONSTRAINT "PK_vtp_selection" PRIMARY KEY ("loc_request_id", "vtp_loc_id")`);
await queryRunner.query(`ALTER TABLE "vtp_selection" DROP COLUMN "issuer"`);
}
}