Skip to content

Commit

Permalink
Add deprecation for new alerts with a migration
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Schnell <[email protected]>
  • Loading branch information
Omega65536 committed Jan 20, 2025
1 parent b70bc84 commit f1f496a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/backend/src/app/db-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -97,6 +98,7 @@ export class DbConfigService implements TypeOrmOptionsFactory {
AddAlertAdditionalBackup1736630779875,
StorageOverflowTime1736550460789,
DeprecatedFlag1737107214086,
DeprecatedFlagNewAlerts1737406388351,
],
logging: true,
logger: 'debug',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class DeprecatedFlagNewAlerts1737406388351 implements MigrationInterface {
name = 'DeprecatedFlagNewAlerts1737406388351'

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`ALTER TABLE "AdditionalBackupAlert" DROP COLUMN "deprecated"`);
await queryRunner.query(`ALTER TABLE "MissingBackupAlert" DROP COLUMN "deprecated"`);
}

}

0 comments on commit f1f496a

Please sign in to comment.