Skip to content

Commit

Permalink
Fixed Custom SQL UpdateOne
Browse files Browse the repository at this point in the history
Wrongly filter was passed to the update SQL
  • Loading branch information
oskardudycz committed Oct 2, 2024
1 parent e33a031 commit 7ca0e8d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/pongo/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/pongo/src/postgres/sqlBuilder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -176,7 +176,7 @@ export const postgresSQLBuilder = (
update: PongoUpdate<T> | 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
Expand Down

0 comments on commit 7ca0e8d

Please sign in to comment.