referencedTable error when querying

Hello! I'm trying to define one to many relations between the tables. While it works for most of the tables, I cannot think of why it fails for SRSCards. I created a very minimal and complete drizzle.run: https://drizzle.run/y2ztrp5ylzvj18klf8kxf932 The error in the playground is different, as locally I get:
Cannot read properties of undefined (reading 'referencedTable') TypeError: Cannot read properties of undefined (reading 'referencedTable')
Cannot read properties of undefined (reading 'referencedTable') TypeError: Cannot read properties of undefined (reading 'referencedTable')
But nevertheless query fails. The goals: - single question can be referenced by multiple SRSCards, - each user can have their own SRSCards, - single SRSCards belongs to only one user and only one question. I feel this is something simple, yet I fail to notice it. Thanks for help in advance.
2 Replies
Kuba
KubaOP2mo ago
Oh man, I just noticed. Sometimes asking for help and narrowing down the problem is self-healing. The culprit was that I forgot to export this particular relation:
- const srsCardsRelations
+ export const srsCardsRelations
- const srsCardsRelations
+ export const srsCardsRelations
Now it works. Leaving the drizzle.run and this thread for future help-seekers.
Kuba
KubaOP2mo ago
This visualizer was a godsend. Tip for the future
No description
Want results from more Discord servers?
Add your server