mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix migration pauses all alert rules on PostgreSQL (#63951)
This commit fixes a serious bug in Grafana 9.4.1 where on upgrade a migration would pause all existing alert rules and change the default value of the column to true.
This commit is contained in:
@@ -290,6 +290,11 @@ func addAlertRuleMigrations(mg *migrator.Migrator, defaultIntervalSeconds int64)
|
||||
Default: "0",
|
||||
},
|
||||
))
|
||||
|
||||
// This migration fixes a bug where "false" for the default value created a column with default "true" in PostgreSQL databases
|
||||
mg.AddMigration("fix is_paused column for alert_rule table", migrator.NewRawSQLMigration("").
|
||||
Postgres(`ALTER TABLE alert_rule ALTER COLUMN is_paused SET DEFAULT false;
|
||||
UPDATE alert_rule SET is_paused = false;`))
|
||||
}
|
||||
|
||||
func addAlertRuleVersionMigrations(mg *migrator.Migrator) {
|
||||
@@ -354,6 +359,11 @@ func addAlertRuleVersionMigrations(mg *migrator.Migrator) {
|
||||
Default: "0",
|
||||
},
|
||||
))
|
||||
|
||||
// This migration fixes a bug where "false" for the default value created a column with default "true" in PostgreSQL databases
|
||||
mg.AddMigration("fix is_paused column for alert_rule_version table", migrator.NewRawSQLMigration("").
|
||||
Postgres(`ALTER TABLE alert_rule_version ALTER COLUMN is_paused SET DEFAULT false;
|
||||
UPDATE alert_rule_version SET is_paused = false;`))
|
||||
}
|
||||
|
||||
func addAlertmanagerConfigMigrations(mg *migrator.Migrator) {
|
||||
|
||||
Reference in New Issue
Block a user