feat(migrations): set default value of groupByMonitor to false for Alert and Incident grouping rules

This commit is contained in:
Nawaz Dhandala
2026-02-09 20:15:15 +00:00
parent 047195116d
commit cd450bc3b6
4 changed files with 32 additions and 4 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<void> {
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<void> {
await queryRunner.query(
`ALTER TABLE "IncidentGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT true`,
);
await queryRunner.query(
`ALTER TABLE "AlertGroupingRule" ALTER COLUMN "groupByMonitor" SET DEFAULT true`,
);
}
}

View File

@@ -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,
];