Alerting: Ensure case-sensitive ordering for alert rule group column

The query which fetches alert rules in a paginated manner ordered by `rule_group` can result in strange and inconsistent ordering when the database uses a case-insensitive collation for the `rule_group` column. This can lead to scenarios where rules from different groups are interleaved in the results, making pagination unreliable and the returned number of rule_groups incorrect.

Related to #88990
This commit is contained in:
Moustafa Baiou
2025-11-03 11:36:18 -05:00
committed by Moustafa Baiou
parent 684156fdf1
commit 6f7c525213
3 changed files with 135 additions and 0 deletions
@@ -156,4 +156,6 @@ func (oss *OSSMigrations) AddMigration(mg *Migrator) {
ualert.DropTitleUniqueIndexMigration(mg)
ualert.AddStateFiredAtColumn(mg)
ualert.CollateAlertRuleGroup(mg)
}