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

Not updating updatedAt #200

Open
Noitidart opened this issue Jun 29, 2021 · 2 comments
Open

Not updating updatedAt #200

Noitidart opened this issue Jun 29, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Noitidart
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Create entity with updatedAt column using TypeOrm:
@UpdateDateColumn()
public updatedAt!: Date;
  1. Do an upsert with one element await TypeOrmUpsert.upsert(English, [{ path: 'foo', phrase: 'hi'}], 'path');

Expected behavior
The "updatedAt" column should update.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: All (Firefox latest, Chrome latest, Safari latest)
  • Version: "@nest-toolbox/typeorm-upsert": "^1.4.2",

Smartphone (please complete the following information):
not applicable

Additional context
not applicable

@lupu60 lupu60 self-assigned this Jun 29, 2021
@lupu60
Copy link
Owner

lupu60 commented Jun 29, 2021

@Noitidart thank you for pointing this issue.
The workaround will be to update the updatedAt with new Date() before inserting.

const newEnglish = {...English, updatedAt:new Date()}
await TypeOrmUpsert.upsert(newEnglish, [{ path: 'foo', phrase: 'hi'}], 'path');

@lupu60 lupu60 added the bug Something isn't working label Jun 29, 2021
@Noitidart
Copy link
Author

Thanks for sharing a workaround! And your fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants