From f1f496a9c27d556b3e26de7f6743d9c467657df4 Mon Sep 17 00:00:00 2001 From: Oliver Schnell Date: Mon, 20 Jan 2025 21:55:53 +0100 Subject: [PATCH] Add deprecation for new alerts with a migration Signed-off-by: Oliver Schnell --- apps/backend/src/app/db-config.service.ts | 2 ++ .../1737406388351-DeprecatedFlagNewAlerts.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 apps/backend/src/app/migrations/1737406388351-DeprecatedFlagNewAlerts.ts diff --git a/apps/backend/src/app/db-config.service.ts b/apps/backend/src/app/db-config.service.ts index 4cbfff1e..bca9481c 100644 --- a/apps/backend/src/app/db-config.service.ts +++ b/apps/backend/src/app/db-config.service.ts @@ -39,6 +39,7 @@ import { AdditionalBackupAlertEntity } from './alerting/entity/alerts/additional import { AddAlertAdditionalBackup1736630779875 } from './migrations/1736630779875-AddAlertAdditionalBackup'; import { StorageOverflowTime1736550460789 } from './migrations/1736550460789-StorageOverflowTime'; import { DeprecatedFlag1737107214086 } from './migrations/1737107214086-DeprecatedFlag'; +import { DeprecatedFlagNewAlerts1737406388351 } from './migrations/1737406388351-DeprecatedFlagNewAlerts'; /** * Used by NestJS to reach database. @@ -97,6 +98,7 @@ export class DbConfigService implements TypeOrmOptionsFactory { AddAlertAdditionalBackup1736630779875, StorageOverflowTime1736550460789, DeprecatedFlag1737107214086, + DeprecatedFlagNewAlerts1737406388351, ], logging: true, logger: 'debug', diff --git a/apps/backend/src/app/migrations/1737406388351-DeprecatedFlagNewAlerts.ts b/apps/backend/src/app/migrations/1737406388351-DeprecatedFlagNewAlerts.ts new file mode 100644 index 00000000..b804515e --- /dev/null +++ b/apps/backend/src/app/migrations/1737406388351-DeprecatedFlagNewAlerts.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class DeprecatedFlagNewAlerts1737406388351 implements MigrationInterface { + name = 'DeprecatedFlagNewAlerts1737406388351' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "MissingBackupAlert" ADD "deprecated" boolean NOT NULL DEFAULT false`); + await queryRunner.query(`ALTER TABLE "AdditionalBackupAlert" ADD "deprecated" boolean NOT NULL DEFAULT false`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "AdditionalBackupAlert" DROP COLUMN "deprecated"`); + await queryRunner.query(`ALTER TABLE "MissingBackupAlert" DROP COLUMN "deprecated"`); + } + +}