[v9.5.x] Alerting: Migration to not fail if alert_configuration table is not empty (#67936)
Alerting: Migration to not fail if alert_configuration table is not empty (#67924)
(cherry picked from commit 0ce7f7eaf4)
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
co-authored by
Yuri Tseretyan
parent
0c0a5ed602
commit
ac5bcf32ae
@@ -459,6 +459,9 @@ func (m *migration) writeAlertmanagerConfig(orgID int64, amConfig *PostableUserC
|
||||
return err
|
||||
}
|
||||
|
||||
// remove an existing configuration, which could have been left during switching back to legacy alerting
|
||||
_, _ = m.sess.Delete(AlertConfiguration{OrgID: orgID})
|
||||
|
||||
// We don't need to apply the configuration, given the multi org alertmanager will do an initial sync before the server is ready.
|
||||
_, err = m.sess.Insert(AlertConfiguration{
|
||||
AlertmanagerConfiguration: string(rawAmConfig),
|
||||
|
||||
Reference in New Issue
Block a user