Hi All,
Want to ask, actually right now I have a view in MySQL. And trying to add it to Prisma’s Schema so I can fetch data from there.
But there is a problem, why it’s will create a new table under that View’s name when I run migrate command? I am using Prisma with NexusJS.
Anyone can help me? very confused right now.
r
Ryan
03/08/2021, 7:22 AM
@David 👋
Unfortunately Views are not yet supported in Prisma. I would suggest adding a 👍 to this request so that we can set the priority for this.
As a workaround, you could create the view with Migrate and then use raw queries to fetch data from the view.
d
David
03/08/2021, 7:27 AM
Hi @Ryan,
Thanks a lot for your response, I see, so for my case it’s either doing the raw queries thing or just create data relationship from scratch in my BE (in this case NexusJS / GraphQL) ?
David
03/08/2021, 7:28 AM
Btw, I up-voted issue #678.
👍 1
r
Ryan
03/08/2021, 7:30 AM
Yes you would need to create the object for the view in Nexus. As views are read-only, you would just need a
Query
type for the same.
🙌 1
d
David
03/08/2021, 7:32 AM
I see, got it Ryan, thanks for the advice and input.
Will try it as a solution. 🍻