mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Create alertmanager config history table (#60103)
Create config history table
This commit is contained in:
parent
435ada45c5
commit
3bdffc92cf
@ -33,6 +33,8 @@ func AddTablesMigrations(mg *migrator.Migrator) {
|
|||||||
AddProvisioningMigrations(mg)
|
AddProvisioningMigrations(mg)
|
||||||
|
|
||||||
AddAlertImageMigrations(mg)
|
AddAlertImageMigrations(mg)
|
||||||
|
|
||||||
|
AddAlertmanagerConfigHistoryMigrations(mg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddAlertDefinitionMigrations should not be modified.
|
// AddAlertDefinitionMigrations should not be modified.
|
||||||
@ -345,6 +347,26 @@ func AddAlertmanagerConfigMigrations(mg *migrator.Migrator) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AddAlertmanagerConfigHistoryMigrations(mg *migrator.Migrator) {
|
||||||
|
alertConfigHistory := migrator.Table{
|
||||||
|
Name: "alert_configuration_history",
|
||||||
|
Columns: []*migrator.Column{
|
||||||
|
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||||
|
{Name: "org_id", Type: migrator.DB_BigInt, Nullable: false, Default: "0"},
|
||||||
|
{Name: "alertmanager_configuration", Type: migrator.DB_MediumText, Nullable: false},
|
||||||
|
{Name: "configuration_hash", Type: migrator.DB_Varchar, Nullable: false, Default: "'not-yet-calculated'", Length: 32},
|
||||||
|
{Name: "configuration_version", Type: migrator.DB_NVarchar, Length: 3}, // In a format of vXX e.g. v1, v2, v10, etc
|
||||||
|
{Name: "created_at", Type: migrator.DB_Int, Nullable: false},
|
||||||
|
{Name: "default", Type: migrator.DB_Bool, Nullable: false, Default: "0"},
|
||||||
|
},
|
||||||
|
Indices: []*migrator.Index{
|
||||||
|
{Cols: []string{"org_id"}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
mg.AddMigration("create_alert_configuration_history_table", migrator.NewAddTableMigration(alertConfigHistory))
|
||||||
|
}
|
||||||
|
|
||||||
func AddAlertAdminConfigMigrations(mg *migrator.Migrator) {
|
func AddAlertAdminConfigMigrations(mg *migrator.Migrator) {
|
||||||
adminConfiguration := migrator.Table{
|
adminConfiguration := migrator.Table{
|
||||||
Name: "ngalert_configuration",
|
Name: "ngalert_configuration",
|
||||||
|
Loading…
Reference in New Issue
Block a user