CloudMigrations: Omit autoincremented id for alert snapshots (#106598)
If you tried to migrate alerts from two differente sources/on-prem instances, the autoincremented numeric id would be the same, and since we were creating the resource in cloud with that same id (the API accepts it), it would return an error "conflicting alert rule found" because that id is the primary key on the table. We simply omit the numeric id now and let the API for the cloud instance generate it.
This commit is contained in:
@@ -135,7 +135,6 @@ type alertRule struct {
|
||||
Title string `json:"title"`
|
||||
ExecErrState string `json:"execErrState"`
|
||||
Data []definitions.AlertQuery `json:"data"`
|
||||
ID int64 `json:"id"`
|
||||
For model.Duration `json:"for"`
|
||||
OrgID int64 `json:"orgID"`
|
||||
IsPaused bool `json:"isPaused"`
|
||||
@@ -158,7 +157,6 @@ func (s *Service) getAlertRules(ctx context.Context, signedInUser *user.SignedIn
|
||||
}
|
||||
|
||||
provisionedAlertRules = append(provisionedAlertRules, alertRule{
|
||||
ID: rule.ID,
|
||||
UID: rule.UID,
|
||||
OrgID: rule.OrgID,
|
||||
FolderUID: rule.NamespaceUID,
|
||||
@@ -208,7 +206,6 @@ func (s *Service) getAlertRuleGroups(ctx context.Context, signedInUser *user.Sig
|
||||
}
|
||||
|
||||
provisionedAlertRules = append(provisionedAlertRules, alertRule{
|
||||
ID: rule.ID,
|
||||
UID: rule.UID,
|
||||
OrgID: rule.OrgID,
|
||||
FolderUID: rule.NamespaceUID,
|
||||
|
||||
Reference in New Issue
Block a user