From 3806b6eec4acfeaad5dc4a8ef3e7b54363f5164e Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:18:57 +0200 Subject: [PATCH] [release-11.5.6] CloudMigrations: Omit autoincremented id for alert snapshots (#106637) 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. (cherry picked from commit a1f2693fd8f648420c200acfa970d9eb01a01852) Co-authored-by: Matheus Macabu --- .../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 c75d8a35df0..73ff4fd5a7b 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,