I'm learning mysql coming from mongoose.
I'm using the t3 stack with drizzle and planet scale and I'm trying to get my head around creating a schema with a many to many relationships.
Tables needed:
credits
categories
Junction table credits_categories
Can anyone show me how they'd set this schema up in Drizzle ORM and query it in the many to many config? I'm struggling to get the hang of it.
Thank you!
Haven't tried anything yet on my own.
My suggestion would be to check out the Drizzle docs.
https://orm.drizzle.team/docs/rqb#many-to-many
The example is for postgres, but you should be able to change the import to use the mysql specific table and columns. Something like this:
Then adjust the example to fit your table definitions and you should be good to go.