Alerting: Migration to not fail if alert_configuration table is not empty (#67924)

This commit is contained in:
Yuri Tseretyan 2023-05-05 12:03:53 -04:00 committed by GitHub
parent 9d16718acc
commit 0ce7f7eaf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -457,6 +457,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),