mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Alerting: modify table and accessors to limit org access appropriately * Update migration to create multiple Alertmanager configs * Apply suggestions from code review Co-authored-by: gotjosh <josue@grafana.com> * replace mg.ClearMigrationEntry() mg.ClearMigrationEntry() would create a new session. This commit introduces a new migration for clearing an entry from migration log for replacing mg.ClearMigrationEntry() so that all dashboard alert migration operations will run inside the same transaction. It adds also `SkipMigrationLog()` in Migrator interface for skipping adding an entry in the migration_log. Co-authored-by: gotjosh <josue@grafana.com>
29 lines
886 B
Go
29 lines
886 B
Go
package models
|
|
|
|
const AlertConfigurationVersion = 1
|
|
|
|
// AlertConfiguration represents a single version of the Alerting Engine Configuration.
|
|
type AlertConfiguration struct {
|
|
ID int64 `xorm:"pk autoincr 'id'"`
|
|
|
|
AlertmanagerConfiguration string
|
|
ConfigurationVersion string
|
|
CreatedAt int64 `xorm:"created"`
|
|
Default bool
|
|
OrgID int64 `xorm:"org_id"`
|
|
}
|
|
|
|
// GetLatestAlertmanagerConfigurationQuery is the query to get the latest alertmanager configuration.
|
|
type GetLatestAlertmanagerConfigurationQuery struct {
|
|
OrgID int64
|
|
Result *AlertConfiguration
|
|
}
|
|
|
|
// SaveAlertmanagerConfigurationCmd is the command to save an alertmanager configuration.
|
|
type SaveAlertmanagerConfigurationCmd struct {
|
|
AlertmanagerConfiguration string
|
|
ConfigurationVersion string
|
|
Default bool
|
|
OrgID int64
|
|
}
|