Skip to content

@UpdateDateColumn does not update on upsert #9015

@udaya2899

Description

@udaya2899

Issue Description

@UpdateDateColumn column updates when using save or update method but not on upsert method

Expected Behavior

@UpdateDateColumn should update automatically with the current timestamp even if using upsert method

Actual Behavior

@UpdateDateColumn does not update with the current timestamp if using upsert. It works only with update method

await this.ormRepository.update(customerEntity.customerId, customerEntity);

Steps to Reproduce

  1. Create a special column as follows:
@UpdateDateColumn()
updatedAt: Date;
  1. Try to update the entity containing the column using upsert.

My Environment

| Dependency | Version |
| "nestjs/typeorm" | "^8.0.0" |
| Operating System |linux |
| Node.js version | 16.13.0 |
| Typescript version | 4.5.5 |
| TypeORM version | 0.2.38 |

Relevant Database Driver(s)

DB Type Reproducible
aurora-mysql no
aurora-postgres no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
spanner 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions