mirror of https://github.com/grafana/grafana
Alerting: Add database migration for recording rule fields (#87012)
* Create recording rule fields in model * Add migration * Write to database, support in version table * extend fingerprint * Force fields to be empty on validate * Another storage spot, tests for fingerprint * Explicitly set defaults in provisioning API * Tests for main API validation * Add diff tests even though fields are unpopulated for now * Use struct tag approach instead of FromDB/ToDB hooks as it better handles nulls when deserializing * test for deser * Backout RecordTo for now since it's not decided in the doc * back out of migration too * Drop datasourceref for now * address linter complaints * Try a single outer struct with all fields embeddedpull/87575/head
parent
9bd44aed2e
commit
36ef611cf4
@ -0,0 +1,18 @@ |
||||
package ualert |
||||
|
||||
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator" |
||||
|
||||
// AddRecordingRuleColumns adds columns to alert_rule to represent recording rules.
|
||||
func AddRecordingRuleColumns(mg *migrator.Migrator) { |
||||
mg.AddMigration("add record column to alert_rule table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_rule"}, &migrator.Column{ |
||||
Name: "record", |
||||
Type: migrator.DB_Text, // Text, to allow for future growth, as this contains a JSON-ified struct.
|
||||
Nullable: true, |
||||
})) |
||||
|
||||
mg.AddMigration("add record column to alert_rule_version table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_rule_version"}, &migrator.Column{ |
||||
Name: "record", |
||||
Type: migrator.DB_Text, |
||||
Nullable: true, |
||||
})) |
||||
} |
||||
Loading…
Reference in new issue