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
Ignore certain fields for @updatedAt
#24080
Comments
Pro-tip: you can manually opt-out from I.e: const env = await prisma.envs.findFirst({})
const envUpdated = await prisma.envs.update({
where: {
id: env.id
},
data: {
status: "new status",
update_time: env.update_time
}
})
// envUpdated.update_time should be the same as env.update_time |
Hey @SuperManito, can you clarify please:
|
My project uses a unified prisma encapsulation operation method and has multiple data models. It is difficult for me to find another way to solve this requirement. |
It is difficult to solve this problem using a where statement because it is too cumbersome to customize. |
@updatedAt
schema@updatedAt
Though would this fire off 2 separate queries? Finding then later updating, or is Prisma smart enough to combine into single call? I'm not familiar with Prisma internals. |
Problem
For example, I have a
status
field and anupdate_time
field, and when I change thestatus
value, I expect that the value of theupdate_time
field will not be automatically updated.Suggested solution
@updatedAtIgnoreFields(['status'])
The text was updated successfully, but these errors were encountered: