Comments (5)
Pro-tip: you can manually opt-out from updatedAt
is updating by providing prisma with the previous value.
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
from prisma.
Hey @SuperManito, can you clarify please:
@updatedAt
triggers whenever the model is updated at all. Are you asking for a way to have the @updatedAt
attribute to only be used when certain values are affected in .update
queries? (i.e. a feature request? the way this is working in your issue is currently intended)
from prisma.
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.
from prisma.
It is difficult to solve this problem using a where statement because it is too cumbersome to customize.
from prisma.
Pro-tip: you can manually opt-out from
updatedAt
is updating by providing prisma with the previous value.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
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.
from prisma.
Related Issues (20)
- Creating and including a related object returns trimmed numbers with `relationJoins`
- `wasm-edge-light-loader.js` importing `node:crypto` instead of using `globalThis.crypto` HOT 11
- Insert or update an item without returning it HOT 3
- Performance problems with batched `findUnique()` HOT 6
- Can't use Prisma Client in Next.js middleware with `@prisma/adapter-pg` and `pg`, even locally HOT 9
- Docs include incorrect information regarding Vercel deployment fix HOT 1
- Model Callbacks and Validations Integration in Prisma HOT 3
- Introspecting error with "Microsoft SQL Server 2019" database HOT 1
- Batched `findUnique()` is not chunked and exceeds parameter binding limits HOT 2
- Gin/Gist index operator classes brought in via PostgreSQL extensions
- Accelerate: "Invalid client engine type, please use `library` or `binary`" on Edge HOT 18
- Undefined "meta" when handling "PrismaClientKnownRequestError"
- Queries are getting executed sequentially even when using Interactive transactions API using Promise.all(). HOT 2
- Webstorm does not support prisma 5.15.0 version of preview functionality HOT 1
- Is the time taken by a complex query in sql run using queryRaw and normal raw sql query the same or does Prisma have to run anything under the hood?
- `update`: Compile-time error is missing if suppliying non-objects to `data` argument
- Add full MongoDB queries to query spans
- findUnique behavior
- Accelerate breaks "PrismaClient is unable to run in this browser environment, or has been bundled for the browser"
- Prisma (v5.12 & v5.14 & v5.15) client has errors accessing `cockroachdb` when using with cloudflare workers and the new `driverAdapter` preview feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma.