I'm new to Prisma and I love using it.
Apparently, I've been working on creating demo servers using MySQL for development purpose. However, when I try to update the prisma.yml file to generate the Prisma graphql schema file, I find there are a couple ways to do this.
First, using the generate property in the yml file like this:
generate:
- generator: graphql-schema
output: ./src/generated/prisma.graphql
Second using the post deploy hook method:
hooks:
post-deploy:
- graphql get-schema -p prisma
Hence, I was thinking which one of these is a more goto approach and what are different use cases for these two different methods?
Outcomes
The one thing I noticed when using the generate method: our generated prisma.grapql file is very condensed and doesn't have any comments written within it.
Snippet:
type Query {
todo(where: TodoWhereUniqueInput!): Todo
todoes(where: TodoWhereInput, orderBy: TodoOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Todo]!
todoesConnection(where: TodoWhereInput, orderBy: TodoOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TodoConnection!
node(id: ID!): Node
}
But while using the post deploy method: the prisma.graphql file comes with various descriptive comments.
Snippet:
type Query {
todoes(where: TodoWhereInput, orderBy: TodoOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Todo]!
todo(where: TodoWhereUniqueInput!): Todo
todoesConnection(where: TodoWhereInput, orderBy: TodoOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TodoConnection!
"""Fetches an object given its ID"""
node(
"""The ID of an object"""
id: ID!
): Node
}
However, I want to know if there's anything more than this and as a beginner I'd suggest you to throw some light on whichever's a good approach to get the Prisma graphql schema.