From e723399f7f91c30a72c84dbdcce6e7d955170d8c Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Tue, 15 Apr 2025 22:09:33 +0530 Subject: [PATCH] fix: add check for empty services (#7611) --- pkg/sqlmigration/026_update_integrations.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/sqlmigration/026_update_integrations.go b/pkg/sqlmigration/026_update_integrations.go index e37e6a17b3..3fecb03f68 100644 --- a/pkg/sqlmigration/026_update_integrations.go +++ b/pkg/sqlmigration/026_update_integrations.go @@ -238,12 +238,14 @@ func (migration *updateIntegrations) Up(ctx context.Context, db *bun.DB) error { if err == nil && len(existingServices) > 0 { newServices := migration. CopyOldCloudIntegrationServicesToNewCloudIntegrationServices(tx, orgIDs[0], existingServices) - _, err = tx. - NewInsert(). - Model(&newServices). - Exec(ctx) - if err != nil { - return err + if len(newServices) > 0 { + _, err = tx. + NewInsert(). + Model(&newServices). + Exec(ctx) + if err != nil { + return err + } } } return nil