[release-11.6.0] Alerting: Add an index to alert_rule_version table on (rule_org_id, rule_uid) (#102353)

Alerting: Add an index to alert_rule_version table on (rule_org_id, rule_uid) (#102347)

(cherry picked from commit 9491fa1895)
This commit is contained in:
Alexander Akhmetov
2025-03-18 12:33:51 +01:00
committed by GitHub
parent 9f280bd5c4
commit c3a547e1c9
2 changed files with 17 additions and 0 deletions
@@ -147,4 +147,6 @@ func (oss *OSSMigrations) AddMigration(mg *Migrator) {
ualert.AddAlertRuleStateTable(mg)
ualert.AddAlertRuleGuidMigration(mg)
ualert.AddAlertRuleVersionUIDIndex(mg)
}
@@ -0,0 +1,15 @@
package ualert
import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
// AddAlertRuleVersionUIDIndex adds an index to the alert_rule_version table on (rule_org_id, rule_uid) columns.
func AddAlertRuleVersionUIDIndex(mg *migrator.Migrator) {
mg.AddMigration("add index to alert_rule_version table on (rule_org_id, rule_uid)",
migrator.NewAddIndexMigration(
migrator.Table{Name: "alert_rule_version"},
&migrator.Index{Cols: []string{"rule_org_id", "rule_uid"}, Type: migrator.IndexType},
),
)
}