From a1f2693fd8f648420c200acfa970d9eb01a01852 Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Thu, 12 Jun 2025 15:38:21 +0200 Subject: [PATCH] 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. --- .../cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go index 886070aee09..570676e7c3f 100644 --- a/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go +++ b/pkg/services/cloudmigration/cloudmigrationimpl/snapshot_mgmt_alerts.go @@ -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,