TypeError: Cannot read properties of undefined (reading 'referencedTable')
Here is the relational query that I'm trying to execute (Turso SQLite):
Here is the schema:
Everytime I run relational query "with:{seller:true}" it throws error. In Drizzlekit studio, the product references seller just fine. What's wrong?
5 Replies
I'm expericing the exact same issue 🤷♂️
I forgot to export the relations 🤦♂️
After that, no more erorr 👍
how did you get rid of the error by just exporting the relations? In my example im exporting relations and still getting the same error
I don't know what to tell you 🤷♂️ I'm still new to Drizzle myself
1. Setup the schema
2. Setup the relations
3. Create migrations
4. Migrate
4. Use with
{ with: clips }
Make sure to import the relations when you declare your schema
const db = drizzle(databaseClient, { schema: { products, recipes, orders, orders_products, orderRelations, ordersProductsRelations } });
like so