You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Using this as an example (found on official docs):
modelUser {idInt@id@default(autoincrement())contentsContent[]}modelContent {idInt@id@default(autoincrement())createdAtDateTime@default(now())updatedAtDateTime@updatedAtpublishedBoolean@default(false)ownerUser@relation(fields: [ownerId], references: [id])ownerIdIntcontentTypeString@@delegate(contentType)}
model Post extends Content {
title String
}
model Video extends Content {
name String
duration Int
}
How can I query Content based on Post's title or Video's name?
Documentation doesn't have an example for this and the generated types also prevent me from doing so.
Describe the solution you'd like
I think I can achieve this if I could have access to the relation. I know that under the hood, zenstack generates this prisma schema
modelContent { ...delegate_aux_postPost?delegate_aux_videoVideo?}
model Post extends Content {
...
delegate_aux_content Content @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
model Video extends Content {
...
delegate_aux_content Content @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
and does all mapping and processing under.
That's why I think, if the relation is available to query on Content I can easily achieve what I desire.
With this, if possible to have access to relation, I can just do
I can see that I can access delegate_aux_post and delegate_aux_video fields of Content using prisma client but not when using the enhanced client.
Describe alternatives you've considered
It would be great if Zenstack could support this feature someday. But for now, I guess I'll just manually manage my polymorphic model, since I badly needed this feature.
Is your feature request related to a problem? Please describe.
Using this as an example (found on official docs):
How can I query Content based on Post's title or Video's name?
Documentation doesn't have an example for this and the generated types also prevent me from doing so.
Describe the solution you'd like
I think I can achieve this if I could have access to the relation. I know that under the hood, zenstack generates this prisma schema
and does all mapping and processing under.
That's why I think, if the relation is available to query on Content I can easily achieve what I desire.
With this, if possible to have access to relation, I can just do
to achieve what I want.
I can see that I can access
delegate_aux_post
anddelegate_aux_video
fields ofContent
using prisma client but not when using the enhanced client.Describe alternatives you've considered
It would be great if Zenstack could support this feature someday. But for now, I guess I'll just manually manage my polymorphic model, since I badly needed this feature.
Additional context
Created from Discord thread: https://discord.com/channels/1035538056146595961/1267761052230221847
The text was updated successfully, but these errors were encountered: