hi guys been trying to wrap my head around integra...
# orm-help
s
hi guys been trying to wrap my head around integrating prisma with our graphql setup
h
Hi @swangy How can I help you with this 🙂
s
so hoping prisma can help - if i understand it right, with a graphql schema i can point prisma at our current schema and get a backend recreated?
h
@swangy Please checkout prisma nexus, it reduces boilerplate code and you can directly expose mutations as well https://github.com/prisma/nexus-prisma
s
one issue i ran into already is
Copy code
DailyNote
    ✖ The relation field `author` must specify a `@relation` directive: `@relation(name: "MyRelation")`
    ✖ The relation field `reviewer` must specify a `@relation` directive: `@relation(name: "MyRelation")`
the schema is
Copy code
author: User @relation(name: "author")
  reviewer: User User @relation(name: "reviewer")
…. what’s goin on?
h
which connector you are using
try
Copy code
author: User @relation(name: "Author")
  reviewer: User @relation(name: "Reviewer")
s
the prisma demo connector
h
oh, ok Try this, if it doesn't work, paste the whole datamodel here
s
hmm..
Copy code
Deploying service `prisma-hello` to stage `dev` to server `prisma-us1` !

ERROR: Syntax error while parsing GraphQL query. Invalid input ""Author")\n  reviewer: User User @", expected IgnoredNoComment or Value (line 111, column 32):
  author: User @relation(name: "Author")
                               ^

{
  "data": {
    "deploy": null
  },
  "errors": [
    {
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "path": [
        "deploy"
      ],
      "code": 3017,
      "message": "Syntax error while parsing GraphQL query. Invalid input \"\"Author\")\\n  reviewer: User User @\", expected IgnoredNoComment or Value (line 111, column 32):\n  author: User @relation(name: \"Author\")\n                               ^",
      "requestId": "us1:cjsg91wge5b7t0b30deomp84o"
    }
  ],
  "status": 200
}
h
you have User twice
paste the datamodel file here
I will send you the corrected one
s
right, there are two types of users, author and reviewer, both of User type…
h
you have done
Copy code
reviewer: User User @relation(name: "reviewer")
Which is not correct
see User twice
s
woops
Copy code
Errors:

  DailyNote
    ✖ The relation field `reviewer` has the type `User`. But the other directive for this relation appeared on the type `Evaluation`
    ✖ The relation field `author` has the type `User`. But the other directive for this relation appeared on the type `Evaluation`

  Evaluation
    ✖ The relation field `reviewer` has the type `User`. But the other directive for this relation appeared on the type `DailyNote`
    ✖ The relation field `author` has the type `User`. But the other directive for this relation appeared on the type `DailyNote`
h
you are defining them twice I think
Please share your datamodel.prisma file with me so that I can help you
Hi
I fixed your problem
the problem was that you were using same relation name at two places
they are must be unique
let me paste the modified datamodel
s
oh huh
thanks!
so now instead of the prisma demo server, how do i get it to connect to local mysql? 🙂
s
TY!