docs/guides/polymorphism #370
Unanswered
Replies: 3 comments 1 reply
-
A note for others reading this: you probably don't want to ever have an enhanced prisma client with only the delegate kind specified since this would disable the access policy (and the other features as well). |
Beta Was this translation helpful? Give feedback.
0 replies
-
Why would count, aggregate, and groupBy not allow RLS on the base fields? I might be misunderstanding, but I thought extending a base model is essentially just using it as a template to write less boilerplate? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Ok thank you for explaining - so with that in mind, is there a way to create boilerplate templates that can be reused along with RLS etc?
If not, it would be super useful - I’ve got a common pattern across pretty much every table (Id, created on, updated on, deleted on), with the deleted on omitted and deleted rows have no access at all.
Further to that, a common user table is extended with relations to the user, visible to that user and hidden to blocked users.
Every single table follows these patterns, and uses values from them to further enable/restrict access.
…On 27 Jun 2025 at 07:55 +0100, Yiming Cao ***@***.***>, wrote:
Extending from a "delegate" base is more than boilerplate. Under the hood it implements the delegate types (aka multi-table-inheritance) pattern for you as described here: https://zenstack.dev/blog/polymorphism#3-delegated-types
Since the inheritance is really backed by relations, it inherits Prisma limitations that for aggregations you can't traverse relation fields. There're several Prisma issues related to it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
docs/guides/polymorphism
Polymorphic Relations
https://zenstack.dev/docs/guides/polymorphism
Beta Was this translation helpful? Give feedback.
All reactions