From 5a6a366f9dde5ccd08c0519ec48142eaf3275034 Mon Sep 17 00:00:00 2001 From: Rubikscraft Date: Tue, 27 Dec 2022 16:14:50 +0100 Subject: [PATCH] Add new db migration --- .../migrations/1672154027079-V_0_5_0_a.ts | 16 ++++++++++++++++ backend/src/database/migrations/index.ts | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 backend/src/database/migrations/1672154027079-V_0_5_0_a.ts diff --git a/backend/src/database/migrations/1672154027079-V_0_5_0_a.ts b/backend/src/database/migrations/1672154027079-V_0_5_0_a.ts new file mode 100644 index 0000000..5541063 --- /dev/null +++ b/backend/src/database/migrations/1672154027079-V_0_5_0_a.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class V050A1672154027079 implements MigrationInterface { + name = 'V050A1672154027079' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`CREATE TABLE "e_system_state_backend" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" character varying NOT NULL, "value" character varying NOT NULL, CONSTRAINT "UQ_f11f1605928b497b24f4b3ecc1f" UNIQUE ("key"), CONSTRAINT "PK_097ea165dadc8c14237481afd64" PRIMARY KEY ("id"))`); + await queryRunner.query(`CREATE INDEX "IDX_f11f1605928b497b24f4b3ecc1" ON "e_system_state_backend" ("key") `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "public"."IDX_f11f1605928b497b24f4b3ecc1"`); + await queryRunner.query(`DROP TABLE "e_system_state_backend"`); + } + +} diff --git a/backend/src/database/migrations/index.ts b/backend/src/database/migrations/index.ts index 07f9fd8..f75529d 100644 --- a/backend/src/database/migrations/index.ts +++ b/backend/src/database/migrations/index.ts @@ -4,6 +4,7 @@ import { V040A1662314197741 } from './1662314197741-V_0_4_0_a'; import { V040B1662485374471 } from './1662485374471-V_0_4_0_b'; import { V040C1662535484200 } from './1662535484200-V_0_4_0_c'; import { V040D1662728275448 } from './1662728275448-V_0_4_0_d'; +import { V050A1672154027079 } from './1672154027079-V_0_5_0_a'; export const MigrationList: Function[] = [ V030A1661692206479, @@ -12,4 +13,5 @@ export const MigrationList: Function[] = [ V040B1662485374471, V040C1662535484200, V040D1662728275448, + V050A1672154027079, ];