I'm very early into my second Prisma-based project...
# orm-help
k
I'm very early into my second Prisma-based project where I started from the graphql advanced boilerplate for Node. I'm keeping up to date and already docker-composing with Prisma v1.8 for local development. I've written myself a nice datamodel file and then a very simplified schema file. When I use
prisma deploy
the mysql DB generates everything (all my tables and relations are there, cool), but
generated/prisma.graphql
is unchanged from the one that the boilerplate gave me not long ago (where it's just users and feeds and posts). I can delete and reset my stuff as much as a want, and
prisma deploy
seems to complete just fine - but the generated schema is totally unchanged.
Ahhh, quickly wisening up to my own problems. I had noticed that when I started this project by default uses the cloud prisma stuff. Well, I'm still new to this and I'm fine using a locally hosted docker container for now. I see that there is this step in `database/prisma.yml`:
Copy code
# Download the GraphQL schema of the Prisma API into 
# `src/generated/prisma.graphql` (as specfied in `.graphqlconfig.yml`).
hooks:
  post-deploy:
    - graphql get-schema --project database
It seems that my locally hosted prisma server isn't behaving correctly. Hitting
<http://localhost:4466/server/dev>
(my server is just called "server" and I'm on the "dev" stage) it complains I don't have auth. So I add the bearer token to the HTTP header and instead simply get an error:
Response not successful: Received status code 500
Attempting
graphql get-schema --project database
Gives me this big hairy error:
Copy code
⚠
Boxed Error: {
    "response": {
      "errors": [{
        "message": "Boxed Error",
        "requestId": "local:api:cjgy6wp2j007e0776atxlxjk0"
      }],
      "status": 500
    },
    "request": {
      "query": "
      query IntrospectionQuery {
        __schema {
          queryType {
            name
          }
          mutationType {
            name
          }
          subscriptionType {
            name
          }
          types {
            ...FullType
          }
          directives {
            name
            description
            locations
            args {
              ...InputValue
            }
          }
        }
      }

      fragment FullType on __Type {
        kind
        name
        description
        fields(includeDeprecated: true) {
          name
          description
          args {
            ...InputValue
          }
          type {
            ...TypeRef
          }
          isDeprecated
          deprecationReason
        }
        inputFields {
          ...InputValue
        }
        interfaces {
          ...TypeRef
        }
        enumValues(includeDeprecated: true) {
          name
          description
          isDeprecated
          deprecationReason
        }
        possibleTypes {
          ...TypeRef
        }
      }

      fragment InputValue on __InputValue {
        name
        description
        type { ...TypeRef
        }
        defaultValue
      }

      fragment TypeRef on __Type {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
                ofType {
                  kind
                  name
                  ofType {
                    kind
                    name
                    ofType {
                      kind
                      name
                    }
                  }
                }
              }
            }
          }
        }
      }
      "}}
n
k
@nilan Nailed it! I had this in my datamodel:
Copy code
# A student has a single enrollment row. An enrollment is their place in the school.
type Enrollment {
  id: ID! @unique
  student: User! @unique @relation(name: "UserToEnrollment")
  courses: [Course!]! @relation(name: "EnrollmentToCourse")
}
Wasn't entirely sure if using @unique on a specific type or having two directives on a line was OK. Suppose not!
n
unique on relations is not supported! I don't fully understand why the error is thrown yet though. if you have more input on this it would be super useful 😊