From 7ca0e8d35c99059dc5eca5aa120345871f22b737 Mon Sep 17 00:00:00 2001 From: Oskar Dudycz Date: Wed, 2 Oct 2024 16:43:02 +0200 Subject: [PATCH] Fixed Custom SQL UpdateOne Wrongly filter was passed to the update SQL --- src/package-lock.json | 6 +++--- src/package.json | 2 +- src/packages/pongo/package.json | 2 +- src/packages/pongo/src/postgres/sqlBuilder/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index ad350a1..679ce6b 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "@event-driven-io/pongo-core", - "version": "0.15.2", + "version": "0.15.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@event-driven-io/pongo-core", - "version": "0.15.2", + "version": "0.15.3", "workspaces": [ "packages/dumbo", "packages/pongo" @@ -8674,7 +8674,7 @@ }, "packages/pongo": { "name": "@event-driven-io/pongo", - "version": "0.15.2", + "version": "0.15.3", "bin": { "pongo": "dist/cli.js" }, diff --git a/src/package.json b/src/package.json index 1bffcbb..e331183 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "@event-driven-io/pongo-core", - "version": "0.15.2", + "version": "0.15.3", "description": "Pongo - Mongo with strong consistency on top of Postgres", "type": "module", "engines": { diff --git a/src/packages/pongo/package.json b/src/packages/pongo/package.json index a34fcb7..5a63b60 100644 --- a/src/packages/pongo/package.json +++ b/src/packages/pongo/package.json @@ -1,6 +1,6 @@ { "name": "@event-driven-io/pongo", - "version": "0.15.2", + "version": "0.15.3", "description": "Pongo - Mongo with strong consistency on top of Postgres", "type": "module", "scripts": { diff --git a/src/packages/pongo/src/postgres/sqlBuilder/index.ts b/src/packages/pongo/src/postgres/sqlBuilder/index.ts index f0d2a90..57d3ded 100644 --- a/src/packages/pongo/src/postgres/sqlBuilder/index.ts +++ b/src/packages/pongo/src/postgres/sqlBuilder/index.ts @@ -88,7 +88,7 @@ export const postgresSQLBuilder = ( expectedVersion != null ? [collectionName, expectedVersion] : []; const filterQuery = isSQL(filter) ? filter : constructFilterQuery(filter); - const updateQuery = isSQL(update) ? filter : buildUpdateQuery(update); + const updateQuery = isSQL(update) ? update : buildUpdateQuery(update); return sql( `WITH existing AS ( @@ -176,7 +176,7 @@ export const postgresSQLBuilder = ( update: PongoUpdate | SQL, ): SQL => { const filterQuery = isSQL(filter) ? filter : constructFilterQuery(filter); - const updateQuery = isSQL(update) ? filter : buildUpdateQuery(update); + const updateQuery = isSQL(update) ? update : buildUpdateQuery(update); return sql( `UPDATE %I