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

Clarify @updatedAt behavior in documentation #3917

Open
panzi opened this issue Oct 17, 2022 · 0 comments
Open

Clarify @updatedAt behavior in documentation #3917

panzi opened this issue Oct 17, 2022 · 0 comments
Labels
docs Documentation creation, updates or corrections

Comments

@panzi
Copy link

panzi commented Oct 17, 2022

Problem

If there are no other columns to update, then the column marked with @updatedAt is not changed, and the update/upsert call doesn't even access the database.
This behavior is not necessarily obvious and should be mentioned in the documentation. Such a documentation would have saved me the time to manually test the behavior just now (after I noticed a cache invalidation bug in my code because of this).

Suggested solution

Add this text:

If there are no other columns to update, then the column marked with @updatedAt is not changed, and the update/upsert call doesn't even access the database. If you want to ensure the column to be updated you need to manually set it in that case.

To this documentation: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#updatedat

(Although I haven't checked the "and the update/upsert call doesn't even access the database" part.)

@janpio janpio transferred this issue from prisma/prisma Oct 18, 2022
@keerlu keerlu added the docs Documentation creation, updates or corrections label Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation creation, updates or corrections
Projects
None yet
Development

No branches or pull requests

3 participants