Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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