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

Closed
panzi opened this issue Oct 17, 2022 · 1 comment · Fixed by #6483
Closed

Clarify @updatedAt behavior in documentation #3917

panzi opened this issue Oct 17, 2022 · 1 comment · Fixed by #6483
Assignees
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
@ankur-arch ankur-arch self-assigned this Dec 2, 2024
ankur-arch added a commit that referenced this issue Dec 4, 2024
@ankur-arch
Copy link
Contributor

Hey 👋 ,

Thanks for creating the issue!

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

I checked and it does access the DB.

This PR should address the rest of your feedback!

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

Successfully merging a pull request may close this issue.

4 participants