Getting "never" type from querying a relation

When I use query function with "with" on a one to many relation it returns the type "never". What am I doing wrong?
No description
2 Replies
predragnikolic
predragnikolic13mo ago
A repository that can reproduce the issue would be welcome That way someone can easy try it out and see whats wrong. also would be best to report that issue to the drizzzle repo.
G$Row
G$RowOP13mo ago
Figured it out. I have my table models in different files and I import them all to create the final schema with which I can create the db object. Turns out I was only adding my table models to the schema and not the relations as well. After adding the relations to the schema it was fixed]. It is never explicitly stated in the docs (as far as I can tell) that you must include the relations in the schema. You have to infer it based on the "Querying" section of the Query page. The first code snippet has index.ts and schema.ts tabs. The way I figured it out was by the line "import * as schema from './schema'; Then when I clicked on the schema.ts tab I noticed that the relations were there. Maybe a short sentence in that section that says the relations must be included as part of your schema could make things a bit more clear.
Want results from more Discord servers?
Add your server