From ffd804d04b9c161e975f5cb75d812a7bab71646e Mon Sep 17 00:00:00 2001 From: Weiko Date: Tue, 7 May 2024 11:07:20 +0200 Subject: [PATCH] Fix convertRecordPositionsToIntegers command for camelCase tables (#5315) ## Context Per title, postgresql will use lowercase if not surrounded by quotes --- .../convert-record-positions-to-integers.command.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/commands/convert-record-positions-to-integers.command.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/commands/convert-record-positions-to-integers.command.ts index 0c5e0b9a51ad..22e196578771 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/commands/convert-record-positions-to-integers.command.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/commands/convert-record-positions-to-integers.command.ts @@ -105,12 +105,12 @@ export class ConvertRecordPositionsToIntegers extends CommandRunner { transactionManager: any, ): Promise { await this.workspaceDataSourceService.executeRawQuery( - `UPDATE ${dataSourceSchema}.${tableName} SET position = subquery.position + `UPDATE ${dataSourceSchema}."${tableName}" SET position = subquery.position FROM ( SELECT id, ROW_NUMBER() OVER (ORDER BY position) as position - FROM ${dataSourceSchema}.${tableName} + FROM ${dataSourceSchema}."${tableName}" ) as subquery - WHERE ${dataSourceSchema}.${tableName}.id = subquery.id`, + WHERE ${dataSourceSchema}."${tableName}".id = subquery.id`, [], workspaceId, transactionManager,