prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.53k stars 861 forks source link

Improve visibility in post processing steps #1927

Closed marktani closed 6 years ago

marktani commented 6 years ago

Feature Request

It's currently not entirely clear what happens for the executed hooks when deploying.

I assume that prisma deploy invokes graphql get-schema andgraphql prepare, but I'm not sure. It would be great to get better visibility into these steps.

A start would be to print these lines as part of the "Hooks" step:

Getting schema: graphql get-schema -p database -o src/generated/prisma.graphql
Generating bundle & binding: graphql prepare -p database -o src/generated

There are probably more approaches that we can follow!

akoenig commented 6 years ago

@marktani This would help a lot and is a quick win for understanding the process. A shameless plug from my side, because I think that here is the right place to foster the discussion: https://github.com/graphql-cli/graphql-cli/issues/211#issuecomment-366447782

A possible implementation strategy could be:

  1. Increase the CLI output as you've described above
  2. Let's discuss if we can increase the overall understanding by modifying the structure of .graphqlconfig

Happy to hear your thoughts :)

johannpinson commented 6 years ago

@marktani Effectively, it's not clear that the prisma deploy uses after some command from graphql-cli (and finally the graphql get-schema use some prisma information like the endpoint to get the introspection).

One particular point is the fact that the configuration from graphqlconfig.yml use in the graphql get-schema override the schema property from prisma.yml and doesn't deliver the same response.

Example with 2 schema generated. File generated with prisma deploy: https://gist.github.com/johannpinson/5406baa5421cfdace22935d7a25c3822

File generated with grapqhql get-schema -p database: https://gist.github.com/johannpinson/379907dc72ddd0fb3313427c0e99ff2c

johannpinson commented 6 years ago

hey @akoenig @marktani

In fact, the funny part is that prisma can use graphql-cli twice, in this case for example:

projects:
  database:
    schemaPath: "src/test.graphql"
    extensions:
      prisma: prisma.yml
      prepare-bundle: src/generated/app.graphql
      prepare-binding:
        output: src/generated/prisma.ts
        generator: prisma-ts

And when I look prisma-version.graphql, the only difference is some additionnal comments and a reorder of the differents objects compared to graphql-version.graphql

However, I think that the major point is linked to the schema property inside prisma.yml, as I describe it in https://github.com/graphcool/prisma/issues/2044. One solution can be to detail more in the docs what is happening when we run a prisma deploy and in which case we may need to use a graphqlconfig.yml

Example: for my part, I need graphqlconfig.yml when I know that I will use the schema trought graphql-yoga (or another GraphQL server) to auto-generate binding

marktani commented 6 years ago

In 1.7.0, we added support for post deployment hooks. They provide great visibility into what happens. In the upgrade guide, it is described how to download the schema and generate the bindings using post deployment hooks.

I'm closing this issue, but please let me know if you still have any questions on this!