Events using prisma

Is there any way I can make some kind of database events using prisma like on create event. I know I can use extend but it's only when using prisma and not for other db connections. Also I find it a little confusing
4 Replies
Zan
Zan2y ago
Prisma
Middleware (Reference)
Prisma Client middleware allows you to perform actions before or after any query on any model with the prisma.$use method.
Zan
Zan2y ago
https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions/query this seems like the modern recommended solution but I haven't used it personally
Prisma
Prisma Client extensions: query component
Extend the functionality of Prisma Client, query component
lecookie
lecookieOP2y ago
Yeah that's what I saw when using extends but it seems kinda complicated
Zan
Zan2y ago
I generally find DB hooks to be too much of an abstracted side effect to shoot yourself in the foot with later - I recommend trying to find a solution that doesn't involve it e.g. if you just need the client to know when stuff updates, use query keys
Want results from more Discord servers?
Add your server