Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Just to expand on this if anyone's looking. Drizzle was automatically creating a relations and schema file in the migrations folder based on an existing db. You have to do this in your db client creation file to combine the two:
|
Beta Was this translation helpful? Give feedback.
-
I am having a the same problem as OP, and the suggested solutions aren't applicable, since I am using an older version of Drizzle which does not export the relations seperately (The reason is, that the newer versions have changed the way objects are named when using a specific schema, when introspecting. This would breaks my entire codebase and I haven't gotten any responses to my issue on the subject) According to the scarce information I've been able to find, a |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I've been running into an issue I haven't come across before, and despite a few hours of trying to locate the issue I am not able to identify it.
I keep on running into an error:
Cannot read properties of undefined (reading 'referencedTable')
When trying to query a table with its relation. I am performing a query.findMany and then including the
with
which is a reference to the reference set up in schema.I have this setup with other tables in the db and they don't cause issues, yet this one does. And in Drizzle studio the relation also correctly shows.
The query
with
I don't run into the error.The table schema
The referenced table
I tried to look up the issue online and found several people that faced the same issue, but none of them seemed to have been resolved.
I've considered creating a separate table for the join only, but I don't see why this would be necessary, since I don't need any additional table properties as part of the relation alone.
Beta Was this translation helpful? Give feedback.
All reactions