Skip to content

Commit 152a030

Browse files
Merge branch 'main' into audit_v3
2 parents 7b74026 + 4f7e926 commit 152a030

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
export enum LogOperationTypeEnum {
2-
addRow = 'addRow',
3-
updateRow = 'updateRow',
4-
deleteRow = 'deleteRow',
5-
unknown = 'unknown',
6-
rowReceived = 'rowReceived',
7-
rowsReceived = 'rowsReceived',
8-
actionActivated = 'actionActivated',
9-
exportRows = 'exportRows',
2+
addRow = 'addRow',
3+
updateRow = 'updateRow',
4+
deleteRow = 'deleteRow',
5+
unknown = 'unknown',
6+
rowReceived = 'rowReceived',
7+
rowsReceived = 'rowsReceived',
8+
actionActivated = 'actionActivated',
9+
importRows = 'importRows',
10+
exportRows = 'exportRows',
1011
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
2+
3+
export class AddNewLogOperationTypes1770801552758 implements MigrationInterface {
4+
name = 'AddNewLogOperationTypes1770801552758';
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(
8+
`ALTER TYPE "public"."tableLogs_operationtype_enum" RENAME TO "tableLogs_operationtype_enum_old"`,
9+
);
10+
await queryRunner.query(
11+
`CREATE TYPE "public"."tableLogs_operationtype_enum" AS ENUM('addRow', 'updateRow', 'deleteRow', 'unknown', 'rowReceived', 'rowsReceived', 'actionActivated', 'importRows', 'exportRows')`,
12+
);
13+
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" DROP DEFAULT`);
14+
await queryRunner.query(
15+
`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" TYPE "public"."tableLogs_operationtype_enum" USING "operationType"::"text"::"public"."tableLogs_operationtype_enum"`,
16+
);
17+
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" SET DEFAULT 'unknown'`);
18+
await queryRunner.query(`DROP TYPE "public"."tableLogs_operationtype_enum_old"`);
19+
}
20+
21+
public async down(queryRunner: QueryRunner): Promise<void> {
22+
await queryRunner.query(
23+
`CREATE TYPE "public"."tableLogs_operationtype_enum_old" AS ENUM('addRow', 'updateRow', 'deleteRow', 'unknown', 'rowReceived', 'rowsReceived', 'actionActivated')`,
24+
);
25+
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" DROP DEFAULT`);
26+
await queryRunner.query(
27+
`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" TYPE "public"."tableLogs_operationtype_enum_old" USING "operationType"::"text"::"public"."tableLogs_operationtype_enum_old"`,
28+
);
29+
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" SET DEFAULT 'unknown'`);
30+
await queryRunner.query(`DROP TYPE "public"."tableLogs_operationtype_enum"`);
31+
await queryRunner.query(
32+
`ALTER TYPE "public"."tableLogs_operationtype_enum_old" RENAME TO "tableLogs_operationtype_enum"`,
33+
);
34+
}
35+
}

0 commit comments

Comments
 (0)