Is possible to obtain the schema.graphql with pris...
# orm-help
m
Is possible to obtain the schema.graphql with prisma from the database? Like
prisma introspect
but not generating datamodel.prisma, generating the SDL schema.
j
Yes, using
graphql-cli
. Run
graphql get-schema --endpoint <your-endpoint> --output /some/where/schema.graphql
🙂
Commonly updating the
schema.graphql
is done with a post deployment hook that you can set in the
prisma.yml
file.
m
Thanks! Ok, but is not an endpoint, it's from the database directly like
prisma introspect
, in this case postgresql that i was asking. Sorry if my question was not clear.
j
Aaaah, ok - sorry! Afaik there is no way to get that. Your best bet would be to introspect, setup the endpoint and from that generate the SDL.
m
Thanks @Jenkins!
🦜 1
h
@MartĂ­ CrespĂ­ You can generate the graphql schema using the prisma cli. Just add a generator like so and run prisma generate
Copy code
generate:
    - generator: graphql-schema
      output: ./generated/
👍 1
m
@Harshit It would be fantastic to be able to execute
prisma generate
with options, I mean, like
prisma generate --type=graphql-schema --output=./generated
and
prisma generate --type=typescript-client --output=./generated/prisma-client/
instead reading from
prisma.yml
file that only allows one type.
h
Please open a feature request for this in GitHub
m
However I was reading the website and I have seen this.. I think it's possible more than one type in
prisma.yml
file at same time.
Generate the Go client and the GraphQL schema store the generated files at ./generated/prisma prisma.yml: generate: - generator: go-client output: ./generated/prisma - generator: graphql-schema output: ./generated/prisma
If it works, it would be perfect too.
Thanks!
h
Yes that I think you misunderstood me, you just need to add that along with the ts client
That works perfectly
m
Ok, i understood overwrite the value, not add a new one. Sorry!
🙌 1
h
Yes , it is an array and we run the general code for all of them
❤️ 1