Alerting: Resize created_by and updated_by columns in alert rules tables (#113870)

This commit is contained in:
Yuri Tseretyan
2025-11-13 17:15:54 -05:00
committed by GitHub
parent 09a7a0c94f
commit 0ab58642c4
2 changed files with 14 additions and 0 deletions
@@ -159,5 +159,7 @@ func (oss *OSSMigrations) AddMigration(mg *Migrator) {
ualert.CollateAlertRuleGroup(mg)
ualert.ExpandAlertRuleUpdatedByMigration(mg)
ualert.AddAlertRuleGroupIndexMigration(mg)
}
@@ -18,3 +18,15 @@ func AddAlertRuleUpdatedByMigration(mg *migrator.Migrator) {
Nullable: true,
}))
}
func ExpandAlertRuleUpdatedByMigration(mg *migrator.Migrator) {
mg.AddMigration("expand created_by in alert_rule_version table", migrator.NewRawSQLMigration("").
SQLite("SELECT 1;"). // do nothing for sqlite because it's a TEXT column
Postgres("ALTER TABLE `alert_rule_version` ALTER COLUMN created_by TYPE VARCHAR(190);").
Mysql("ALTER TABLE `alert_rule_version` MODIFY created_by VARCHAR(190);"))
mg.AddMigration("expand updated_by in alert_rule table", migrator.NewRawSQLMigration("").
SQLite("SELECT 1;"). // do nothing for sqlite because it's a TEXT column
Postgres("ALTER TABLE `alert_rule` ALTER COLUMN updated_by TYPE VARCHAR(190);").
Mysql("ALTER TABLE `alert_rule` MODIFY updated_by VARCHAR(190);"))
}