-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1693571860507-AddAckByBooleans.ts
26 lines (20 loc) · 1.81 KB
/
1693571860507-AddAckByBooleans.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddAckByBooleans1693571860507 implements MigrationInterface {
name = 'AddAckByBooleans1693571860507'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "loc_request_file" ADD "acknowledged_by_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "loc_request_file" ADD "acknowledged_by_verified_issuer" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "loc_metadata_item" ADD "acknowledged_by_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "loc_metadata_item" ADD "acknowledged_by_verified_issuer" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`UPDATE "loc_request_file" SET "acknowledged_by_owner" = "acknowledged_by_owner_on" IS NOT NULL`);
await queryRunner.query(`UPDATE "loc_request_file" SET "acknowledged_by_verified_issuer" = "acknowledged_by_verified_issuer_on" IS NOT NULL`);
await queryRunner.query(`UPDATE "loc_metadata_item" SET "acknowledged_by_owner" = "acknowledged_by_owner_on" IS NOT NULL`);
await queryRunner.query(`UPDATE "loc_metadata_item" SET "acknowledged_by_verified_issuer" = "acknowledged_by_verified_issuer_on" IS NOT NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "loc_metadata_item" DROP COLUMN "acknowledged_by_verified_issuer"`);
await queryRunner.query(`ALTER TABLE "loc_metadata_item" DROP COLUMN "acknowledged_by_owner"`);
await queryRunner.query(`ALTER TABLE "loc_request_file" DROP COLUMN "acknowledged_by_verified_issuer"`);
await queryRunner.query(`ALTER TABLE "loc_request_file" DROP COLUMN "acknowledged_by_owner"`);
}
}