Hello, I have this model on Prisma 1, many-to-many...
# orm-help
r
Hello, I have this model on Prisma 1, many-to-many relashionship between User and WindTurbine, And I keep getting the error bellow (at the end of the message ERROR: relation \"default$default._WindTurbinesUsers\" does not exist\n P): It seems the user property in WindTurbine is null, and the table/or relationship is not created in DB Any idea how to fix and get a proper query/mutation wthout throwing errors? __ type User { id: ID! @id windTurbines: [WindTurbine] } type WindTurbine { id: ID! @id users: [User] } __
Copy code
{
    windTurbines( 
      where: { id: "ck6kkbz5r00ms0804tc1oz05f"}
    )
	{
    id
    users {name}
  }
}
Copy code
{
  "data": {
    "windTurbines": [
      {
        "id": "ck6kkbz5r00ms0804tc1oz05f",
        "users": null
      }
    ]
  },
  "errors": [
    {
      "message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck8yokfr43lg90738p9zxaviv",
      "path": [
        "windTurbines",
        0,
        "users"
      ],
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ],
      "requestId": "local:ck8yokfr43lg90738p9zxaviv"
    }
  ]
}
How can I fix this? Notes: • No realtion table is created in postgres db • Tried also adding l windTurbines: WindTurbine! @relation(link:TABLE, name: "UsersWindTurbines") type UsersWindTurbines @relationTable { user: User! windTurbine: WindTurbine! }
{"key":"error/unhandled","requestId":"local:ck8yo9nfd3co10738lild9ofb","clientId":"default$default","payload":{"exception":"org.postgresql.util.PSQLException: ERROR: relation \"default$default._WindTurbinesUsers\" does not exist\n Position: 182","query":"{\n windTurbines(where: {id: \"ck6kkbz5r00ms0804tc1oz05f\"}) {\n name\n users {\n name\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)\\n
s
You can try reproducing the same on prisma demo server and see if it is postgres related issue or is it something else. finding the root cause that way would help.
r
Hey @Raluca Fleseriu You can try the above method and if not we could look more into this!
r
ok, thanks! Looking into demo server, I'll let you know afterwards
👍 1