From cd450bc3b6c4837b1f8cd21de38f91b5fe79d605 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Mon, 9 Feb 2026 20:15:15 +0000 Subject: [PATCH] feat(migrations): set default value of groupByMonitor to false for Alert and Incident grouping rules --- .../DatabaseModels/AlertGroupingRule.ts | 4 +-- .../DatabaseModels/IncidentGroupingRule.ts | 4 +-- .../1770668054908-MigrationName.ts | 26 +++++++++++++++++++ .../Postgres/SchemaMigrations/Index.ts | 2 ++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 Common/Server/Infrastructure/Postgres/SchemaMigrations/1770668054908-MigrationName.ts diff --git a/Common/Models/DatabaseModels/AlertGroupingRule.ts b/Common/Models/DatabaseModels/AlertGroupingRule.ts index 0e63245559..cf4e43f911 100644 --- a/Common/Models/DatabaseModels/AlertGroupingRule.ts +++ b/Common/Models/DatabaseModels/AlertGroupingRule.ts @@ -674,13 +674,13 @@ export default class AlertGroupingRule extends BaseModel { title: "Group By Monitor", description: "When enabled, alerts from different monitors will be grouped into separate episodes. When disabled, alerts from any monitor can be grouped together.", - defaultValue: true, + defaultValue: false, isDefaultValueColumn: true, }) @Column({ type: ColumnType.Boolean, nullable: false, - default: true, + default: false, }) public groupByMonitor?: boolean = undefined; diff --git a/Common/Models/DatabaseModels/IncidentGroupingRule.ts b/Common/Models/DatabaseModels/IncidentGroupingRule.ts index 43648637dc..d1da58ec8b 100644 --- a/Common/Models/DatabaseModels/IncidentGroupingRule.ts +++ b/Common/Models/DatabaseModels/IncidentGroupingRule.ts @@ -678,13 +678,13 @@ export default class IncidentGroupingRule extends BaseModel { title: "Group By Monitor", description: "When enabled, incidents from different monitors will be grouped into separate episodes. When disabled, incidents from any monitor can be grouped together.", - defaultValue: true, + defaultValue: false, isDefaultValueColumn: true, }) @Column({ type: ColumnType.Boolean, nullable: false, - default: true, + default: false, }) public groupByMonitor?: boolean = undefined; diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1770668054908-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1770668054908-MigrationName.ts new file mode 100644 index 0000000000..df228221ac --- /dev/null +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1770668054908-MigrationName.ts @@ -0,0 +1,26 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import CaptureSpan from "../../../Utils/Telemetry/CaptureSpan"; + +export class MigrationName1770668054908 implements MigrationInterface { + public name = "MigrationName1770668054908"; + + @CaptureSpan() + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IncidentGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "AlertGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT false`, + ); + } + + @CaptureSpan() + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IncidentGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "AlertGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT true`, + ); + } +} diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts index 9b936d98c4..22a9561cd3 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts @@ -253,6 +253,7 @@ import { MigrationName1770232207959 } from "./1770232207959-MigrationName"; import { MigrationName1770237245069 } from "./1770237245069-MigrationName"; import { MigrationName1770237245070 } from "./1770237245070-MigrationName"; import { MigrationName1770407024682 } from "./1770407024682-MigrationName"; +import { MigrationName1770668054908 } from "./1770668054908-MigrationName"; export default [ InitialMigration, @@ -510,4 +511,5 @@ export default [ MigrationName1770237245069, MigrationName1770237245070, MigrationName1770407024682, + MigrationName1770668054908, ];