From 23cf85f745fbf9aa4c0dee9d8a6fa0a2f40d36ed Mon Sep 17 00:00:00 2001 From: Weiko Date: Tue, 21 Jul 2026 17:22:53 +0200 Subject: [PATCH] Fix invalid UUID insert in workflow core-links backfill (#23118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Fix invalid UUID insert in workflow core-links backfill ### Problem The `2-23:backfill-workflow-core-links` workspace upgrade command failed with: ``` QueryFailedError: invalid input syntax for type uuid: "" (22P02) ``` The `core."workflow"."lastPublishedVersionId"` column is a `uuid`, but some workspace workflows store an empty string `""` (not `NULL`) for that field. The code used `workflow.lastPublishedVersionId ?? null`, and `??` only falls back on `null`/`undefined` — so `""` was passed straight through and Postgres rejected it. ### Fix Use `|| null` instead of `?? null` so empty strings are normalized to `null` before insertion into the `uuid` column. Review in cubic --- ...ommand-1784286707000-backfill-workflow-core-links.command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784286707000-backfill-workflow-core-links.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784286707000-backfill-workflow-core-links.command.ts index 14a5f72102..95bd1f56ed 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784286707000-backfill-workflow-core-links.command.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784286707000-backfill-workflow-core-links.command.ts @@ -110,7 +110,7 @@ export class BackfillWorkflowCoreLinksCommand extends ProvisionedWorkspaceComman uuidv4(), applicationId, workflow.name ?? null, - workflow.lastPublishedVersionId ?? null, + workflow.lastPublishedVersionId || null, ], );