Prisma2 Data Model


#1

Hi, I’ve been evaluating Prisma for a future project and I’ve just read the blog posts about Prisma 2. The changes to the database access syntax and organisation of migrations look good, and although I didn’t have a problem with the separate server the switch to Rust seems like a good idea - I can only imagine how much work is involved in starting from scratch. But the new data model syntax is a big concern for me.

One of the features of the current Prisma that I find most compelling is the use of GraphQL to define the data model for an application. I can then reuse the same file to provide the data model for my front end GraphQL APIs, extended with queries and mutations that suit the various use cases. Indeed I was a bit dissapointed that it wasn’t easier to directly proxy the Prisma Server GraphQL to my front end, at least during the prototyping phase. I bought into the idea of separation of API logic from basic CRUD operations, but the idea that I now have to completely redeclare the data model at both layers in a different syntax is a concern. And the combination of datasource configuration along with the data model seems really strange too, I’d have to bake all my different environment details into one file. Plus, I like VS Code but there are those of us who mainly use different editors. WebStorm supports the current GraphQL syntax just fine. Do you plan to provide plugins for the new syntax for other IDEs?

I saw a link to the RFC project on GitHub in the blog. Although it covers the spec in some detail I couldn’t find motivations or reasoning for the change there. The repo was closed for comments/issues. Hence the question here. The recommended channel for feedback seems to be a Slack channel - which is itself a bit of a worry.

I realise this is an early preview. Would be interested to know if this decision is final, and whether there is a more formalised communication about the design process than a chat room.

Don’t wish to sound negative. Many thanks for the interesting work Prisma represents in this area, and look forward to see how Primsa 2 develops.


#2

Hi. I had the same problem as you. according to this blog series the Prisma team seems to strongly suggest using graphql nexus to define GraphQL schema alongside Typescript types.
So what we are trying to achieve (A schema first approach without duplication) is very hard in Prisma 2.