Files
grafana/pkg/services/sqlstore/migrations/ualert/state_resolvedat_mig.go
T
Matthew Jacobson ba800692c6 Alerting: Persist AlertInstance ResolvedAt & LastSentAt (#89135)
* Alerting: Persist AlertInstance ResolvedAt & LastSentAt

* Fix test

* Modify existing tests

* Fix merge conflicts from nullable LastSentAt & ResolvedAt
2024-07-12 12:26:58 -04:00

19 lines
763 B
Go

package ualert
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
// AddStateResolvedAtColumns adds columns to alert_instance to represent ResolvedAt and LastSentAt.
func AddStateResolvedAtColumns(mg *migrator.Migrator) {
mg.AddMigration("add resolved_at column to alert_instance table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_instance"}, &migrator.Column{
Name: "resolved_at",
Type: migrator.DB_BigInt, // BigInt, to match existing time fields.
Nullable: true,
}))
mg.AddMigration("add last_sent_at column to alert_instance table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_instance"}, &migrator.Column{
Name: "last_sent_at",
Type: migrator.DB_BigInt,
Nullable: true,
}))
}