Alerting: Add message to alert_rule_version table (Part 1). (#114194)

This adds a `message` column to the `alert_rule_version` table. This follows the
pattern established for dashboards as closely as possible. A new type is
introduced internally for passing the new `message` field around in a type-safe
manner, but doing the same for the API types becomes very messy. In that case, a
new field is added with omitempty.

Note this PR is only:
- The column addition
- The "read" path; API for listing versions

Subsequent PRs will add code to actually set the message when updating rules.
This commit is contained in:
Steve Simpson
2025-11-20 10:00:27 +01:00
committed by GitHub
parent 1d763df932
commit cc6e037093
11 changed files with 105 additions and 21 deletions
@@ -24,6 +24,9 @@ func AddTablesMigrations(mg *migrator.Migrator) {
mg.AddMigration("add last_applied column to alert_configuration_history", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_configuration_history"}, &migrator.Column{
Name: "last_applied", Type: migrator.DB_Int, Nullable: false, Default: "0",
}))
mg.AddMigration("add message column to alert_rule_version", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_rule_version"}, &migrator.Column{
Name: "message", Type: migrator.DB_Text, Nullable: true,
}))
// End of migration log, add new migrations above this line.
}