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

Generated asExpression columns not in RETURNING clause on save #8450

Closed
Migushthe2nd opened this issue Dec 11, 2021 · 4 comments · Fixed by #10632 or kanelv/url-shortener#23 · May be fixed by scamcloud/stalkeescam#2, trailblazing-dx/tiago_app.snyk_nodejs-goof#8 or SWall16/nodejs-goof#214

Comments

@Migushthe2nd
Copy link

Migushthe2nd commented Dec 11, 2021

Issue Description

When an entity with a STORED generated column is saved, the generated column is not included in the RETURNING clause, causing the object not to get populated with the generated column's value.

Expected Behavior

query: START TRANSACTION
query: INSERT INTO "typeorm"."user"("generated", "email", "username", "password") VALUES (DEFAULT, $1, $2, $3) RETURNING "counter", "generated" -- PARAMETERS: ["email@example.com","username","hash"]
query: COMMIT

The generated generated column is in the RETURNING statement.

BEFORE SAVE: UserEntity {
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}
AFTER SAVE: UserEntity {
  counter: 2,
  generated: 4,
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}
WHEN FETCHING MANUALLY: UserEntity {
  counter: 2,
  generated: 4,
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}

Actual Behavior

Using the new stored generated column type:

query: START TRANSACTION
query: INSERT INTO "typeorm"."user"("generated", "email", "username", "password") VALUES (DEFAULT, $1, $2, $3) RETURNING "counter" -- PARAMETERS: ["email@example.com","username","hash"]
query: COMMIT

As you can see, the column generated is not in the RETURNING statement, which causes the entity not to get populated properly with the column's value:

BEFORE SAVE: UserEntity {
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}
AFTER SAVE: UserEntity {
  counter: 2,
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}
WHEN FETCHING MANUALLY: UserEntity {
  counter: 2,
  generated: 4,
  email: 'email@example.com',
  username: 'username',
  password: 'hash'
}

Steps to Reproduce

@Entity()
export class UserEntity extends BaseEntity {

    @PrimaryGeneratedColumn()
    counter: number;

    // generated column defined here
    @Column({
        type: "int",
        generatedType: "STORED",
        asExpression: `counter * 2`,
    })
    generated: number;

    @Column({unique: true, nullable: true})
    email?: string;

    @Column({length: 32})
    username: string;

    @Column({nullable: true})
    password?: string;

}

The code I use to test this:

const user = UserEntity.create({email, password, username});
console.log("BEFORE SAVE:", user)
user.save();
console.log("AFTER SAVE:", user)

const userFound = await UserEntity.find({where: {email}})
console.log("WHEN FETCHING MANUALLY:", userFound)

My Environment

Dependency Version
Operating System Windows 11
Node.js version v16.13.1
Typescript version 4.4.4
TypeORM version 0.2.41

Additional Context

The generated column feature was implemented in the PostgreSQL driver by #6469, so perhaps @TheNoim knows what's missing.

The column seems to be missing from this array:

getInsertionReturningColumns(): ColumnMetadata[] {
// for databases which support returning statement we need to return extra columns like id
// for other databases we don't need to return id column since its returned by a driver already
const needToCheckGenerated = this.queryRunner.connection.driver.isReturningSqlSupported();
// filter out the columns of which we need database inserted values to update our entity
return this.expressionMap.mainAlias!.metadata.columns.filter(column => {
return column.default !== undefined ||
(needToCheckGenerated && column.isGenerated) ||
column.isCreateDate ||
column.isUpdateDate ||
column.isDeleteDate ||
column.isVersion;
});
}

column.isGenerated is false, to be specific.

Relevant Database Driver(s)

DB Type Reproducible
aurora-data-api no
aurora-data-api-pg no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql yes
nativescript no
oracle no
postgres yes
react-native no
sap no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

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

  • ✅ Yes, I have the time, and I know how to start.
  • ✖️Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
@TheNoim
Copy link
Contributor

TheNoim commented Dec 17, 2021

I never intended this feature for usage with PrimaryColumn. Is this the only way how you could archive this?

@Migushthe2nd
Copy link
Author

Migushthe2nd commented Dec 17, 2021

I have thought of making counter the primary column, and making id unique and adding an index. I would still need to add a foreign key referencing id which is not possible.

Addition: using the computed id as primary key reduces complexity. It would allow my system to identify entities by a single type of id, instead of allowing both a computed id and a numeric id everywhere. These two might get mixed up unintentionally (numeric ids are in the range of the computed ids)

@Migushthe2nd Migushthe2nd changed the title Cascaded insert with primary generated column causes non-null contraint error in PostgreSQL database Generated column not in RETURNING clause on save - PostgreSQL database Dec 18, 2021
@Migushthe2nd
Copy link
Author

It seems the issue of not returning the generated column is not specific to cascaded inserts, nor to primary columns. I have updated the issue quite a bit, so please read it again.

@Migushthe2nd Migushthe2nd mentioned this issue Dec 18, 2021
7 tasks
@Migushthe2nd Migushthe2nd changed the title Generated column not in RETURNING clause on save - PostgreSQL database Generated asExpression columns not in RETURNING clause on save Dec 18, 2021
@maks-rafalko-unagi
Copy link

maks-rafalko-unagi commented Sep 13, 2023

I can confirm this bug still exists on 0.3.*

#8472 is closed for some reason, but @pleerock can you advice was this PR a right fix?

With the current master, this is how we fixed it thanks to https://www.npmjs.com/package/patch-package

diff --git a/node_modules/typeorm/metadata/EntityMetadata.js b/node_modules/typeorm/metadata/EntityMetadata.js
index f12c352..8c47ebe 100644
--- a/node_modules/typeorm/metadata/EntityMetadata.js
+++ b/node_modules/typeorm/metadata/EntityMetadata.js
@@ -678,6 +678,7 @@ class EntityMetadata {
     getInsertionReturningColumns() {
         return this.columns.filter((column) => {
             return (column.default !== undefined ||
+                column.asExpression ||
                 column.isGenerated ||
                 column.isCreateDate ||
                 column.isUpdateDate ||

maartensijmkens added a commit to maartensijmkens/typeorm that referenced this issue Jan 15, 2024
maartensijmkens added a commit to maartensijmkens/typeorm that referenced this issue Jan 15, 2024
AlexMesser pushed a commit that referenced this issue Jan 26, 2024
* fix: include asExpression columns in returning clause

Closes: #8450

* test: add test for issue #8450
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