Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository find method where option could not combine conditions properly #10534

Closed
1 of 18 tasks
hyt658 opened this issue Dec 2, 2023 · 5 comments · Fixed by #10650 or kanelv/url-shortener#23 · May be fixed by scamcloud/stalkeescam#2, trailblazing-dx/tiago_prod_nodejs-goof#8 or SWall16/nodejs-goof#214

Comments

@hyt658
Copy link

hyt658 commented Dec 2, 2023

Issue description

Lack of brackets for the conditions in where when translated to the real query in DB and connected with AND

Expected Behavior

If I do:
dataSource.getRepository(Gift).find({where: { cond1: "...", cond2: "..." })
In the database it should be:
SELECT gift_id from Gifts where (cond1) AND (cond2)

Actual Behavior

In the database it actually is:
SELECT gift_id from Gifts where cond1 AND cond2

Steps to reproduce

Assume table Gift has start_date and end_date represents the available period for users to earn the gift. Now I input user's year and month to check what gifts he can earn. Code:
image
I have to use brackets to enclose the entire Raw sentence to make sure these two conditions are paralleled, otherwise the AND and OR will mess up

My Environment

Dependency Version
Operating System MacOS
Node.js version 20.6.0
Typescript version 5.2.2
TypeORM version 0.3.17

Additional Context

Postgresql log:

2023-12-02 11:32:21.276 EST [25970] LOG:  duration: 2.879 ms  parse <unnamed>: SELECT "Gift"."gift_id" AS "Gift_gift_id", "Gift"."content" AS "Gift_content", "Gift"."type" AS "Gift_type", "Gift"."quantity" AS "Gift_quantity", "Gift"."start_date" AS "Gift_start_date", "Gift"."end_date" AS "Gift_end_date", "Gift"."category" AS "Gift_category", "Gift"."image" AS "Gift_image" FROM "gifts" "Gift" WHERE (EXTRACT(YEAR FROM "Gift"."start_date") < $1) OR 
	                (EXTRACT(YEAR FROM "Gift"."start_date") = $2 AND EXTRACT(MONTH FROM "Gift"."start_date") <= $3) AND (EXTRACT(YEAR FROM "Gift"."end_date")) > $4 OR 
	                (EXTRACT(YEAR FROM "Gift"."end_date") = $5 AND EXTRACT(MONTH FROM "Gift"."end_date") >= $6) LIMIT 20
2023-12-02 11:32:21.278 EST [25970] LOG:  duration: 2.153 ms  bind <unnamed>: SELECT "Gift"."gift_id" AS "Gift_gift_id", "Gift"."content" AS "Gift_content", "Gift"."type" AS "Gift_type", "Gift"."quantity" AS "Gift_quantity", "Gift"."start_date" AS "Gift_start_date", "Gift"."end_date" AS "Gift_end_date", "Gift"."category" AS "Gift_category", "Gift"."image" AS "Gift_image" FROM "gifts" "Gift" WHERE (EXTRACT(YEAR FROM "Gift"."start_date") < $1) OR 
	                (EXTRACT(YEAR FROM "Gift"."start_date") = $2 AND EXTRACT(MONTH FROM "Gift"."start_date") <= $3) AND (EXTRACT(YEAR FROM "Gift"."end_date")) > $4 OR 
	                (EXTRACT(YEAR FROM "Gift"."end_date") = $5 AND EXTRACT(MONTH FROM "Gift"."end_date") >= $6) LIMIT 20
2023-12-02 11:32:21.278 EST [25970] DETAIL:  parameters: $1 = '2023', $2 = '2023', $3 = '3', $4 = '2023', $5 = '2023', $6 = '3'
2023-12-02 11:32:21.278 EST [25970] LOG:  execute <unnamed>: SELECT "Gift"."gift_id" AS "Gift_gift_id", "Gift"."content" AS "Gift_content", "Gift"."type" AS "Gift_type", "Gift"."quantity" AS "Gift_quantity", "Gift"."start_date" AS "Gift_start_date", "Gift"."end_date" AS "Gift_end_date", "Gift"."category" AS "Gift_category", "Gift"."image" AS "Gift_image" FROM "gifts" "Gift" WHERE (EXTRACT(YEAR FROM "Gift"."start_date") < $1) OR 
	                (EXTRACT(YEAR FROM "Gift"."start_date") = $2 AND EXTRACT(MONTH FROM "Gift"."start_date") <= $3) AND (EXTRACT(YEAR FROM "Gift"."end_date")) > $4 OR 
	                (EXTRACT(YEAR FROM "Gift"."end_date") = $5 AND EXTRACT(MONTH FROM "Gift"."end_date") >= $6) LIMIT 20
2023-12-02 11:32:21.278 EST [25970] DETAIL:  parameters: $1 = '2023', $2 = '2023', $3 = '3', $4 = '2023', $5 = '2023', $6 = '3'
2023-12-02 11:32:21.279 EST [25970] LOG:  duration: 0.444 ms

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

@alenap93
Copy link
Contributor

alenap93 commented Jan 6, 2024

@hyt658, you have nested conditions in your Raw, so i think that this behaviour is correct, and you have to set parenthesis around conditions...

@hyt658
Copy link
Author

hyt658 commented Jan 8, 2024

@alenap93 thanks for your reply. I think when listing several conditions in where: {...}, it should be expected that they will be linked parallelly with and (even if they are nested). For example, in C/C++, if we want to create a macro to do MIN operation between two numbers:

#define min(x, y) ((x)>(y) ? (y) : (x))

We have to enclose x and y in parentheses because x and y maybe expressions instead of single numbers. I know it might not be correct to use C/C++ logic to think of typescript, but what I mean is, adding parentheses for conditions does not have any bad influence and it can avoid potential issues.

@esdrasbrz
Copy link
Contributor

The same problem occurs with findBy, for instance:

const result = await database
  .getRepository(Gift)
  .findBy({
    startDate: MoreThanOrEqual(initialDate),
    endDate: Or(
      LessThanOrEqual(finalDate),
      IsNull(),
    ),
  })

generates the following SQL:

SELECT ... FROM gift
WHERE (start_date >= $1 AND end_date <= $2 OR end_date IS NULL)

instead of:

SELECT ... FROM gift
WHERE (start_date >= $1 AND (end_date <= $2 OR end_date IS NULL))

This is a very unexpected behavior, and I think it should automatically add the parenthesis around conditions, especially using Or and And.

Also, is it even possible to change the typescript code to make it include the parenthesis around the Or? I had to make a query similar to this one with Query Builder instead because I couldn't find a way to fix the conditions, but it would be much easier to use findBy.

@alenap93
Copy link
Contributor

@esdrasbrz i will work for this fix in the next days

@esdrasbrz
Copy link
Contributor

@alenap93 thanks!

alenap93 added a commit to alenap93/typeorm that referenced this issue Jan 21, 2024
added missing parentheses in where conditions and with And/Or operators

Closes: typeorm#10534
pleerock pushed a commit that referenced this issue Jan 26, 2024
added missing parentheses in where conditions and with And/Or operators

Closes: #10534
Vylpes pushed a commit to Vylpes/vylbot-app that referenced this issue Jan 31, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typeorm](https://typeorm.io) ([source](https://github.com/typeorm/typeorm)) | dependencies | patch | [`0.3.17` -> `0.3.20`](https://renovatebot.com/diffs/npm/typeorm/0.3.17/0.3.20) |

---

### Release Notes

<details>
<summary>typeorm/typeorm (typeorm)</summary>

### [`v0.3.20`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0320-2024-01-26)

[Compare Source](typeorm/typeorm@0.3.19...0.3.20)

##### Bug Fixes

-   added missing parentheses in where conditions ([#&#8203;10650](typeorm/typeorm#10650)) ([4624930](typeorm/typeorm@4624930)), closes [#&#8203;10534](typeorm/typeorm#10534)
-   don't escape indexPredicate ([#&#8203;10618](typeorm/typeorm#10618)) ([dd49a25](typeorm/typeorm@dd49a25))
-   fallback runMigrations transaction to DataSourceOptions ([#&#8203;10601](typeorm/typeorm#10601)) ([0cab0dd](typeorm/typeorm@0cab0dd))
-   hangup when load relations with relationLoadStrategy: query ([#&#8203;10630](typeorm/typeorm#10630)) ([54d8d9e](typeorm/typeorm@54d8d9e)), closes [#&#8203;10481](typeorm/typeorm#10481)
-   include asExpression columns in returning clause ([#&#8203;10632](typeorm/typeorm#10632)) ([f232ba7](typeorm/typeorm@f232ba7)), closes [#&#8203;8450](typeorm/typeorm#8450) [#&#8203;8450](typeorm/typeorm#8450)
-   multiple insert in SAP Hana ([#&#8203;10597](typeorm/typeorm#10597)) ([1b34c9a](typeorm/typeorm@1b34c9a))
-   resolve issue CREATE/DROP Index concurrently ([#&#8203;10634](typeorm/typeorm#10634)) ([8aa8690](typeorm/typeorm@8aa8690)), closes [#&#8203;10626](typeorm/typeorm#10626)
-   type inferencing of EntityManager#create ([#&#8203;10569](typeorm/typeorm#10569)) ([99d8249](typeorm/typeorm@99d8249))

##### Features

-   add json type support for Oracle ([#&#8203;10611](typeorm/typeorm#10611)) ([7e85460](typeorm/typeorm@7e85460))
-   add postgres multirange column types ([#&#8203;10627](typeorm/typeorm#10627)) ([d0b7670](typeorm/typeorm@d0b7670)), closes [#&#8203;10556](typeorm/typeorm#10556)
-   add table comment for postgres ([#&#8203;10613](typeorm/typeorm#10613)) ([4493db4](typeorm/typeorm@4493db4))

##### Reverts

-   Revert "fix: prevent using absolute table path in migrations unless required ([#&#8203;10123](typeorm/typeorm#10123))" ([#&#8203;10624](typeorm/typeorm#10624)) ([8f371f2](typeorm/typeorm@8f371f2)), closes [#&#8203;10123](typeorm/typeorm#10123) [#&#8203;10624](typeorm/typeorm#10624)
-   revert "feat: nullable embedded entities ([#&#8203;10289](typeorm/typeorm#10289))" ([#&#8203;10614](typeorm/typeorm#10614)) ([15de46f](typeorm/typeorm@15de46f)), closes [#&#8203;10289](typeorm/typeorm#10289) [#&#8203;10614](typeorm/typeorm#10614)

### [`v0.3.19`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0319-2024-01-03)

[Compare Source](typeorm/typeorm@0.3.18...0.3.19)

##### Bug Fixes

-   fixed `Cannot read properties of undefined (reading 'sync')` caused after glob package upgrade

### [`v0.3.18`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0318-2024-01-03)

[Compare Source](typeorm/typeorm@0.3.17...0.3.18)

##### Bug Fixes

-   add BaseEntity to model-shim ([#&#8203;10503](typeorm/typeorm#10503)) ([3cf938e](typeorm/typeorm@3cf938e))
-   add error handling for missing join columns ([#&#8203;10525](typeorm/typeorm#10525)) ([122c897](typeorm/typeorm@122c897)), closes [#&#8203;7034](typeorm/typeorm#7034)
-   add missing export for View class ([#&#8203;10261](typeorm/typeorm#10261)) ([7adbc9b](typeorm/typeorm@7adbc9b))
-   added fail callback while opening the database in Cordova ([#&#8203;10566](typeorm/typeorm#10566)) ([8b4df5b](typeorm/typeorm@8b4df5b))
-   aggregate function throw error when column alias name is set ([#&#8203;10035](typeorm/typeorm#10035)) ([022d2b5](typeorm/typeorm@022d2b5)), closes [#&#8203;9927](typeorm/typeorm#9927)
-   backport postgres connection error handling to crdb ([#&#8203;10177](typeorm/typeorm#10177)) ([149226d](typeorm/typeorm@149226d))
-   bump better-sqlite3 version range ([#&#8203;10452](typeorm/typeorm#10452)) ([75ec8f2](typeorm/typeorm@75ec8f2))
-   caching always enabled not caching queries ([#&#8203;10524](typeorm/typeorm#10524)) ([8af533f](typeorm/typeorm@8af533f))
-   circular dependency breaking node.js 20.6 ([#&#8203;10344](typeorm/typeorm#10344)) ([ba7ad3c](typeorm/typeorm@ba7ad3c)), closes [#&#8203;10338](typeorm/typeorm#10338)
-   correctly keep query.data from ormOption for commit / rollback subscribers ([#&#8203;10151](typeorm/typeorm#10151)) ([73ee70b](typeorm/typeorm@73ee70b))
-   default value in child table/entity column decorator for multiple table inheritance is ignored for inherited columns ([#&#8203;10563](typeorm/typeorm#10563)) ([#&#8203;10564](typeorm/typeorm#10564)) ([af77a5d](typeorm/typeorm@af77a5d))
-   deletedAt column leaking as side effect of object update while creating a row ([#&#8203;10435](typeorm/typeorm#10435)) ([7de4890](typeorm/typeorm@7de4890))
-   empty objects being hydrated when eager loading relations that have a `@VirtualColumn` ([#&#8203;10432](typeorm/typeorm#10432)) ([b53e410](typeorm/typeorm@b53e410)), closes [#&#8203;10431](typeorm/typeorm#10431)
-   extend GiST index with range types for Postgres driver ([#&#8203;10572](typeorm/typeorm#10572)) ([a4900ae](typeorm/typeorm@a4900ae)), closes [#&#8203;10567](typeorm/typeorm#10567)
-   ignore changes for columns with `update: false` in persistence ([#&#8203;10250](typeorm/typeorm#10250)) ([f8fa1fd](typeorm/typeorm@f8fa1fd)), closes [#&#8203;10249](typeorm/typeorm#10249)
-   improve helper for cli for commands missing positionals ([#&#8203;10133](typeorm/typeorm#10133)) ([9f8899f](typeorm/typeorm@9f8899f))
-   loading datasource unable to process a regular default export ([#&#8203;10184](typeorm/typeorm#10184)) ([201342d](typeorm/typeorm@201342d)), closes [#&#8203;8810](typeorm/typeorm#8810)
-   logMigration has incorrect logging condition ([#&#8203;10323](typeorm/typeorm#10323)) ([d41930f](typeorm/typeorm@d41930f)), closes [#&#8203;10322](typeorm/typeorm#10322) [#&#8203;10322](typeorm/typeorm#10322)
-   ManyToMany ER_DUP_ENTRY error ([#&#8203;10343](typeorm/typeorm#10343)) ([e296063](typeorm/typeorm@e296063)), closes [#&#8203;5704](typeorm/typeorm#5704)
-   migrations on indexed TIMESTAMP WITH TIME ZONE Oracle columns ([#&#8203;10506](typeorm/typeorm#10506)) ([cf37f13](typeorm/typeorm@cf37f13)), closes [#&#8203;10493](typeorm/typeorm#10493)
-   mongodb - undefined is not constructor ([#&#8203;10559](typeorm/typeorm#10559)) ([ad5bf11](typeorm/typeorm@ad5bf11))
-   mongodb resolves leaked cursor ([#&#8203;10316](typeorm/typeorm#10316)) ([2dc9624](typeorm/typeorm@2dc9624)), closes [#&#8203;10315](typeorm/typeorm#10315)
-   mssql datasource testonborrow not affecting anything ([#&#8203;10589](typeorm/typeorm#10589)) ([122b683](typeorm/typeorm@122b683))
-   nested transactions issues ([#&#8203;10210](typeorm/typeorm#10210)) ([25e6ecd](typeorm/typeorm@25e6ecd))
-   prevent using absolute table path in migrations unless required ([#&#8203;10123](typeorm/typeorm#10123)) ([dd59524](typeorm/typeorm@dd59524))
-   remove `date-fns` in favor of `DayJs` ([#&#8203;10306](typeorm/typeorm#10306)) ([cf7147f](typeorm/typeorm@cf7147f))
-   remove dynamic require calls ([#&#8203;10196](typeorm/typeorm#10196)) ([a939654](typeorm/typeorm@a939654))
-   resolve circular dependency when using Vite ([#&#8203;10273](typeorm/typeorm#10273)) ([080528b](typeorm/typeorm@080528b))
-   resolve issue building eager relation alias for nested relations ([#&#8203;10004](typeorm/typeorm#10004)) ([c6f608d](typeorm/typeorm@c6f608d)), closes [#&#8203;9944](typeorm/typeorm#9944)
-   resolve issue of generating migration for numeric arrays repeatedly ([#&#8203;10471](typeorm/typeorm#10471)) ([39fdcf6](typeorm/typeorm@39fdcf6)), closes [#&#8203;10043](typeorm/typeorm#10043)
-   resolve issue queryBuilder makes different parameter identifiers for same parameter ([#&#8203;10327](typeorm/typeorm#10327)) ([6c918ea](typeorm/typeorm@6c918ea)), closes [#&#8203;7308](typeorm/typeorm#7308)
-   resolve issues on upsert ([#&#8203;10588](typeorm/typeorm#10588)) ([dc1bfed](typeorm/typeorm@dc1bfed)), closes [#&#8203;10587](typeorm/typeorm#10587)
-   scrub all comment end markers from comments ([#&#8203;10163](typeorm/typeorm#10163)) ([d937f61](typeorm/typeorm@d937f61))
-   serialize bigint when building a query id [#&#8203;10336](typeorm/typeorm#10336) ([#&#8203;10337](typeorm/typeorm#10337)) ([bfc1cc5](typeorm/typeorm@bfc1cc5))
-   should automatically cache if alwaysEnable ([#&#8203;10137](typeorm/typeorm#10137)) ([173910e](typeorm/typeorm@173910e)), closes [#&#8203;9910](typeorm/typeorm#9910)
-   SQLite simple-enum column parsing ([#&#8203;10550](typeorm/typeorm#10550)) ([696e688](typeorm/typeorm@696e688))
-   update UpdateDateColumn on upsert ([#&#8203;10458](typeorm/typeorm#10458)) ([fdb9866](typeorm/typeorm@fdb9866)), closes [#&#8203;9015](typeorm/typeorm#9015)
-   upgrade ts-node version to latest(10.9.1) version ([#&#8203;10143](typeorm/typeorm#10143)) ([fcb9904](typeorm/typeorm@fcb9904))
-   using async datasource to configure typeorm ([#&#8203;10170](typeorm/typeorm#10170)) ([fbd45db](typeorm/typeorm@fbd45db))

##### Features

-   ability to change default replication mode ([#&#8203;10419](typeorm/typeorm#10419)) ([72b1d1b](typeorm/typeorm@72b1d1b))
-   add concurrent indexes for postgres ([#&#8203;10442](typeorm/typeorm#10442)) ([f4e6eaf](typeorm/typeorm@f4e6eaf))
-   add exists and exists by ([#&#8203;10291](typeorm/typeorm#10291)) ([b6b46fb](typeorm/typeorm@b6b46fb))
-   add isolated where statements ([#&#8203;10213](typeorm/typeorm#10213)) ([3cda7ec](typeorm/typeorm@3cda7ec))
-   add MSSQL disableAsciiToUnicodeParamConversion option and tests ([#&#8203;10161](typeorm/typeorm#10161)) ([df7c069](typeorm/typeorm@df7c069)), closes [#&#8203;10131](typeorm/typeorm#10131)
-   add support for mssql server DefaultAzureCredential usage ([#&#8203;10246](typeorm/typeorm#10246)) ([c8ee5b1](typeorm/typeorm@c8ee5b1))
-   add support for table comment in MySQL ([#&#8203;10017](typeorm/typeorm#10017)) ([338df16](typeorm/typeorm@338df16))
-   allow to use custom type witch extends object type for find where argument ([#&#8203;10475](typeorm/typeorm#10475)) ([48f5f85](typeorm/typeorm@48f5f85))
-   BeforeQuery and AfterQuery events ([#&#8203;10234](typeorm/typeorm#10234)) ([5c28154](typeorm/typeorm@5c28154)), closes [#&#8203;3302](typeorm/typeorm#3302)
-   custom STI discriminator value for EntitySchema ([#&#8203;10508](typeorm/typeorm#10508)) ([b240d87](typeorm/typeorm@b240d87)), closes [#&#8203;10494](typeorm/typeorm#10494)
-   enabled CTE for oracle driver ([#&#8203;10319](typeorm/typeorm#10319)) ([65858f3](typeorm/typeorm@65858f3))
-   entityId in InsertEvent ([#&#8203;10540](typeorm/typeorm#10540)) ([ae006af](typeorm/typeorm@ae006af))
-   expose countDocuments in mongodb ([#&#8203;10314](typeorm/typeorm#10314)) ([ebd61d1](typeorm/typeorm@ebd61d1))
-   exposed entity and criteria properties on EntityNotFoundError ([#&#8203;10202](typeorm/typeorm#10202)) ([bafcd17](typeorm/typeorm@bafcd17))
-   implement column comments for SAP HANA ([#&#8203;10502](typeorm/typeorm#10502)) ([45e31cc](typeorm/typeorm@45e31cc))
-   implement OR operator ([#&#8203;10086](typeorm/typeorm#10086)) ([a00b1df](typeorm/typeorm@a00b1df)), closes [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054)
-   implement streaming for SAP HANA ([#&#8203;10512](typeorm/typeorm#10512)) ([7e9cead](typeorm/typeorm@7e9cead))
-   implements QueryFailedError generic for driverError typing ([#&#8203;10253](typeorm/typeorm#10253)) ([78b2f48](typeorm/typeorm@78b2f48))
-   modify repository.extend method for chaining repositories ([#&#8203;10256](typeorm/typeorm#10256)) ([ca29c0f](typeorm/typeorm@ca29c0f))
-   nullable embedded entities ([#&#8203;10289](typeorm/typeorm#10289)) ([e67d704](typeorm/typeorm@e67d704))
-   support for MongoDB 6.x ([#&#8203;10545](typeorm/typeorm#10545)) ([3647b26](typeorm/typeorm@3647b26))
-   support mssql@10 ([#&#8203;10356](typeorm/typeorm#10356)) ([f6bb671](typeorm/typeorm@f6bb671)), closes [#&#8203;10340](typeorm/typeorm#10340)
-   use node-oracledb 6 ([#&#8203;10285](typeorm/typeorm#10285)) ([3af891a](typeorm/typeorm@3af891a)), closes [#&#8203;10277](typeorm/typeorm#10277)
-   user-defined index name for STI discriminator column ([#&#8203;10509](typeorm/typeorm#10509)) ([89c5257](typeorm/typeorm@89c5257)), closes [#&#8203;10496](typeorm/typeorm#10496)

##### Performance Improvements

-   improve SapQueryRunner performance ([#&#8203;10198](typeorm/typeorm#10198)) ([f6b87e3](typeorm/typeorm@f6b87e3))

##### BREAKING CHANGES

-   With node-oracledb the thin client is used as default. Added a option to use the thick client. Also added the option to specify the instant client lib
-   MongoDB: from the previous behavior of returning a result with metadata describing when a document is not found.
    See: https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES\_6.0.0.md
-   [new nullable embeds feature](typeorm/typeorm#10289) introduced a breaking change which might enforce you to update types on your entities to `  | null `,
    if all columns in your embed entity are nullable. Since database queries now return embedded property as `null` if all its column values are null.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/395
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Vylpes pushed a commit to Vylpes/Droplet that referenced this issue Apr 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typeorm](https://typeorm.io) ([source](https://github.com/typeorm/typeorm)) | dependencies | patch | [`0.3.17` -> `0.3.20`](https://renovatebot.com/diffs/npm/typeorm/0.3.17/0.3.20) |

---

### Release Notes

<details>
<summary>typeorm/typeorm (typeorm)</summary>

### [`v0.3.20`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0320-2024-01-26)

[Compare Source](typeorm/typeorm@0.3.19...0.3.20)

##### Bug Fixes

-   added missing parentheses in where conditions ([#&#8203;10650](typeorm/typeorm#10650)) ([4624930](typeorm/typeorm@4624930)), closes [#&#8203;10534](typeorm/typeorm#10534)
-   don't escape indexPredicate ([#&#8203;10618](typeorm/typeorm#10618)) ([dd49a25](typeorm/typeorm@dd49a25))
-   fallback runMigrations transaction to DataSourceOptions ([#&#8203;10601](typeorm/typeorm#10601)) ([0cab0dd](typeorm/typeorm@0cab0dd))
-   hangup when load relations with relationLoadStrategy: query ([#&#8203;10630](typeorm/typeorm#10630)) ([54d8d9e](typeorm/typeorm@54d8d9e)), closes [#&#8203;10481](typeorm/typeorm#10481)
-   include asExpression columns in returning clause ([#&#8203;10632](typeorm/typeorm#10632)) ([f232ba7](typeorm/typeorm@f232ba7)), closes [#&#8203;8450](typeorm/typeorm#8450) [#&#8203;8450](typeorm/typeorm#8450)
-   multiple insert in SAP Hana ([#&#8203;10597](typeorm/typeorm#10597)) ([1b34c9a](typeorm/typeorm@1b34c9a))
-   resolve issue CREATE/DROP Index concurrently ([#&#8203;10634](typeorm/typeorm#10634)) ([8aa8690](typeorm/typeorm@8aa8690)), closes [#&#8203;10626](typeorm/typeorm#10626)
-   type inferencing of EntityManager#create ([#&#8203;10569](typeorm/typeorm#10569)) ([99d8249](typeorm/typeorm@99d8249))

##### Features

-   add json type support for Oracle ([#&#8203;10611](typeorm/typeorm#10611)) ([7e85460](typeorm/typeorm@7e85460))
-   add postgres multirange column types ([#&#8203;10627](typeorm/typeorm#10627)) ([d0b7670](typeorm/typeorm@d0b7670)), closes [#&#8203;10556](typeorm/typeorm#10556)
-   add table comment for postgres ([#&#8203;10613](typeorm/typeorm#10613)) ([4493db4](typeorm/typeorm@4493db4))

##### Reverts

-   Revert "fix: prevent using absolute table path in migrations unless required ([#&#8203;10123](typeorm/typeorm#10123))" ([#&#8203;10624](typeorm/typeorm#10624)) ([8f371f2](typeorm/typeorm@8f371f2)), closes [#&#8203;10123](typeorm/typeorm#10123) [#&#8203;10624](typeorm/typeorm#10624)
-   revert "feat: nullable embedded entities ([#&#8203;10289](typeorm/typeorm#10289))" ([#&#8203;10614](typeorm/typeorm#10614)) ([15de46f](typeorm/typeorm@15de46f)), closes [#&#8203;10289](typeorm/typeorm#10289) [#&#8203;10614](typeorm/typeorm#10614)

### [`v0.3.19`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0319-2024-01-03)

[Compare Source](typeorm/typeorm@0.3.18...0.3.19)

##### Bug Fixes

-   fixed `Cannot read properties of undefined (reading 'sync')` caused after glob package upgrade

### [`v0.3.18`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0318-2024-01-03)

[Compare Source](typeorm/typeorm@0.3.17...0.3.18)

##### Bug Fixes

-   add BaseEntity to model-shim ([#&#8203;10503](typeorm/typeorm#10503)) ([3cf938e](typeorm/typeorm@3cf938e))
-   add error handling for missing join columns ([#&#8203;10525](typeorm/typeorm#10525)) ([122c897](typeorm/typeorm@122c897)), closes [#&#8203;7034](typeorm/typeorm#7034)
-   add missing export for View class ([#&#8203;10261](typeorm/typeorm#10261)) ([7adbc9b](typeorm/typeorm@7adbc9b))
-   added fail callback while opening the database in Cordova ([#&#8203;10566](typeorm/typeorm#10566)) ([8b4df5b](typeorm/typeorm@8b4df5b))
-   aggregate function throw error when column alias name is set ([#&#8203;10035](typeorm/typeorm#10035)) ([022d2b5](typeorm/typeorm@022d2b5)), closes [#&#8203;9927](typeorm/typeorm#9927)
-   backport postgres connection error handling to crdb ([#&#8203;10177](typeorm/typeorm#10177)) ([149226d](typeorm/typeorm@149226d))
-   bump better-sqlite3 version range ([#&#8203;10452](typeorm/typeorm#10452)) ([75ec8f2](typeorm/typeorm@75ec8f2))
-   caching always enabled not caching queries ([#&#8203;10524](typeorm/typeorm#10524)) ([8af533f](typeorm/typeorm@8af533f))
-   circular dependency breaking node.js 20.6 ([#&#8203;10344](typeorm/typeorm#10344)) ([ba7ad3c](typeorm/typeorm@ba7ad3c)), closes [#&#8203;10338](typeorm/typeorm#10338)
-   correctly keep query.data from ormOption for commit / rollback subscribers ([#&#8203;10151](typeorm/typeorm#10151)) ([73ee70b](typeorm/typeorm@73ee70b))
-   default value in child table/entity column decorator for multiple table inheritance is ignored for inherited columns ([#&#8203;10563](typeorm/typeorm#10563)) ([#&#8203;10564](typeorm/typeorm#10564)) ([af77a5d](typeorm/typeorm@af77a5d))
-   deletedAt column leaking as side effect of object update while creating a row ([#&#8203;10435](typeorm/typeorm#10435)) ([7de4890](typeorm/typeorm@7de4890))
-   empty objects being hydrated when eager loading relations that have a `@VirtualColumn` ([#&#8203;10432](typeorm/typeorm#10432)) ([b53e410](typeorm/typeorm@b53e410)), closes [#&#8203;10431](typeorm/typeorm#10431)
-   extend GiST index with range types for Postgres driver ([#&#8203;10572](typeorm/typeorm#10572)) ([a4900ae](typeorm/typeorm@a4900ae)), closes [#&#8203;10567](typeorm/typeorm#10567)
-   ignore changes for columns with `update: false` in persistence ([#&#8203;10250](typeorm/typeorm#10250)) ([f8fa1fd](typeorm/typeorm@f8fa1fd)), closes [#&#8203;10249](typeorm/typeorm#10249)
-   improve helper for cli for commands missing positionals ([#&#8203;10133](typeorm/typeorm#10133)) ([9f8899f](typeorm/typeorm@9f8899f))
-   loading datasource unable to process a regular default export ([#&#8203;10184](typeorm/typeorm#10184)) ([201342d](typeorm/typeorm@201342d)), closes [#&#8203;8810](typeorm/typeorm#8810)
-   logMigration has incorrect logging condition ([#&#8203;10323](typeorm/typeorm#10323)) ([d41930f](typeorm/typeorm@d41930f)), closes [#&#8203;10322](typeorm/typeorm#10322) [#&#8203;10322](typeorm/typeorm#10322)
-   ManyToMany ER_DUP_ENTRY error ([#&#8203;10343](typeorm/typeorm#10343)) ([e296063](typeorm/typeorm@e296063)), closes [#&#8203;5704](typeorm/typeorm#5704)
-   migrations on indexed TIMESTAMP WITH TIME ZONE Oracle columns ([#&#8203;10506](typeorm/typeorm#10506)) ([cf37f13](typeorm/typeorm@cf37f13)), closes [#&#8203;10493](typeorm/typeorm#10493)
-   mongodb - undefined is not constructor ([#&#8203;10559](typeorm/typeorm#10559)) ([ad5bf11](typeorm/typeorm@ad5bf11))
-   mongodb resolves leaked cursor ([#&#8203;10316](typeorm/typeorm#10316)) ([2dc9624](typeorm/typeorm@2dc9624)), closes [#&#8203;10315](typeorm/typeorm#10315)
-   mssql datasource testonborrow not affecting anything ([#&#8203;10589](typeorm/typeorm#10589)) ([122b683](typeorm/typeorm@122b683))
-   nested transactions issues ([#&#8203;10210](typeorm/typeorm#10210)) ([25e6ecd](typeorm/typeorm@25e6ecd))
-   prevent using absolute table path in migrations unless required ([#&#8203;10123](typeorm/typeorm#10123)) ([dd59524](typeorm/typeorm@dd59524))
-   remove `date-fns` in favor of `DayJs` ([#&#8203;10306](typeorm/typeorm#10306)) ([cf7147f](typeorm/typeorm@cf7147f))
-   remove dynamic require calls ([#&#8203;10196](typeorm/typeorm#10196)) ([a939654](typeorm/typeorm@a939654))
-   resolve circular dependency when using Vite ([#&#8203;10273](typeorm/typeorm#10273)) ([080528b](typeorm/typeorm@080528b))
-   resolve issue building eager relation alias for nested relations ([#&#8203;10004](typeorm/typeorm#10004)) ([c6f608d](typeorm/typeorm@c6f608d)), closes [#&#8203;9944](typeorm/typeorm#9944)
-   resolve issue of generating migration for numeric arrays repeatedly ([#&#8203;10471](typeorm/typeorm#10471)) ([39fdcf6](typeorm/typeorm@39fdcf6)), closes [#&#8203;10043](typeorm/typeorm#10043)
-   resolve issue queryBuilder makes different parameter identifiers for same parameter ([#&#8203;10327](typeorm/typeorm#10327)) ([6c918ea](typeorm/typeorm@6c918ea)), closes [#&#8203;7308](typeorm/typeorm#7308)
-   resolve issues on upsert ([#&#8203;10588](typeorm/typeorm#10588)) ([dc1bfed](typeorm/typeorm@dc1bfed)), closes [#&#8203;10587](typeorm/typeorm#10587)
-   scrub all comment end markers from comments ([#&#8203;10163](typeorm/typeorm#10163)) ([d937f61](typeorm/typeorm@d937f61))
-   serialize bigint when building a query id [#&#8203;10336](typeorm/typeorm#10336) ([#&#8203;10337](typeorm/typeorm#10337)) ([bfc1cc5](typeorm/typeorm@bfc1cc5))
-   should automatically cache if alwaysEnable ([#&#8203;10137](typeorm/typeorm#10137)) ([173910e](typeorm/typeorm@173910e)), closes [#&#8203;9910](typeorm/typeorm#9910)
-   SQLite simple-enum column parsing ([#&#8203;10550](typeorm/typeorm#10550)) ([696e688](typeorm/typeorm@696e688))
-   update UpdateDateColumn on upsert ([#&#8203;10458](typeorm/typeorm#10458)) ([fdb9866](typeorm/typeorm@fdb9866)), closes [#&#8203;9015](typeorm/typeorm#9015)
-   upgrade ts-node version to latest(10.9.1) version ([#&#8203;10143](typeorm/typeorm#10143)) ([fcb9904](typeorm/typeorm@fcb9904))
-   using async datasource to configure typeorm ([#&#8203;10170](typeorm/typeorm#10170)) ([fbd45db](typeorm/typeorm@fbd45db))

##### Features

-   ability to change default replication mode ([#&#8203;10419](typeorm/typeorm#10419)) ([72b1d1b](typeorm/typeorm@72b1d1b))
-   add concurrent indexes for postgres ([#&#8203;10442](typeorm/typeorm#10442)) ([f4e6eaf](typeorm/typeorm@f4e6eaf))
-   add exists and exists by ([#&#8203;10291](typeorm/typeorm#10291)) ([b6b46fb](typeorm/typeorm@b6b46fb))
-   add isolated where statements ([#&#8203;10213](typeorm/typeorm#10213)) ([3cda7ec](typeorm/typeorm@3cda7ec))
-   add MSSQL disableAsciiToUnicodeParamConversion option and tests ([#&#8203;10161](typeorm/typeorm#10161)) ([df7c069](typeorm/typeorm@df7c069)), closes [#&#8203;10131](typeorm/typeorm#10131)
-   add support for mssql server DefaultAzureCredential usage ([#&#8203;10246](typeorm/typeorm#10246)) ([c8ee5b1](typeorm/typeorm@c8ee5b1))
-   add support for table comment in MySQL ([#&#8203;10017](typeorm/typeorm#10017)) ([338df16](typeorm/typeorm@338df16))
-   allow to use custom type witch extends object type for find where argument ([#&#8203;10475](typeorm/typeorm#10475)) ([48f5f85](typeorm/typeorm@48f5f85))
-   BeforeQuery and AfterQuery events ([#&#8203;10234](typeorm/typeorm#10234)) ([5c28154](typeorm/typeorm@5c28154)), closes [#&#8203;3302](typeorm/typeorm#3302)
-   custom STI discriminator value for EntitySchema ([#&#8203;10508](typeorm/typeorm#10508)) ([b240d87](typeorm/typeorm@b240d87)), closes [#&#8203;10494](typeorm/typeorm#10494)
-   enabled CTE for oracle driver ([#&#8203;10319](typeorm/typeorm#10319)) ([65858f3](typeorm/typeorm@65858f3))
-   entityId in InsertEvent ([#&#8203;10540](typeorm/typeorm#10540)) ([ae006af](typeorm/typeorm@ae006af))
-   expose countDocuments in mongodb ([#&#8203;10314](typeorm/typeorm#10314)) ([ebd61d1](typeorm/typeorm@ebd61d1))
-   exposed entity and criteria properties on EntityNotFoundError ([#&#8203;10202](typeorm/typeorm#10202)) ([bafcd17](typeorm/typeorm@bafcd17))
-   implement column comments for SAP HANA ([#&#8203;10502](typeorm/typeorm#10502)) ([45e31cc](typeorm/typeorm@45e31cc))
-   implement OR operator ([#&#8203;10086](typeorm/typeorm#10086)) ([a00b1df](typeorm/typeorm@a00b1df)), closes [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054) [#&#8203;10054](typeorm/typeorm#10054)
-   implement streaming for SAP HANA ([#&#8203;10512](typeorm/typeorm#10512)) ([7e9cead](typeorm/typeorm@7e9cead))
-   implements QueryFailedError generic for driverError typing ([#&#8203;10253](typeorm/typeorm#10253)) ([78b2f48](typeorm/typeorm@78b2f48))
-   modify repository.extend method for chaining repositories ([#&#8203;10256](typeorm/typeorm#10256)) ([ca29c0f](typeorm/typeorm@ca29c0f))
-   nullable embedded entities ([#&#8203;10289](typeorm/typeorm#10289)) ([e67d704](typeorm/typeorm@e67d704))
-   support for MongoDB 6.x ([#&#8203;10545](typeorm/typeorm#10545)) ([3647b26](typeorm/typeorm@3647b26))
-   support mssql@10 ([#&#8203;10356](typeorm/typeorm#10356)) ([f6bb671](typeorm/typeorm@f6bb671)), closes [#&#8203;10340](typeorm/typeorm#10340)
-   use node-oracledb 6 ([#&#8203;10285](typeorm/typeorm#10285)) ([3af891a](typeorm/typeorm@3af891a)), closes [#&#8203;10277](typeorm/typeorm#10277)
-   user-defined index name for STI discriminator column ([#&#8203;10509](typeorm/typeorm#10509)) ([89c5257](typeorm/typeorm@89c5257)), closes [#&#8203;10496](typeorm/typeorm#10496)

##### Performance Improvements

-   improve SapQueryRunner performance ([#&#8203;10198](typeorm/typeorm#10198)) ([f6b87e3](typeorm/typeorm@f6b87e3))

##### BREAKING CHANGES

-   With node-oracledb the thin client is used as default. Added a option to use the thick client. Also added the option to specify the instant client lib
-   MongoDB: from the previous behavior of returning a result with metadata describing when a document is not found.
    See: https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES\_6.0.0.md
-   [new nullable embeds feature](typeorm/typeorm#10289) introduced a breaking change which might enforce you to update types on your entities to `  | null `,
    if all columns in your embed entity are nullable. Since database queries now return embedded property as `null` if all its column values are null.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/Droplet/pulls/258
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment