Open kidqueb opened 1 year ago
Would love this too. I initially scrolled past this request based on the title, since your example (and how I'm using many-to-many) is how I actually expected many-to-many relations to work, and not how I remembered many-through relations working in Laravel.
In Laravel/Eloquent, $user->groups
returns an array of Group
models, not UserToGroup
models. It doesn't make you manually jump through the pivot table like Drizzle does, it does that for you.
I actually thought the second argument to many()
was for this purpose, since it accepts { relationName: string }
, but it turns out that's also on one()
and doesn't work. :(
This would be huge. Tbh this is one of the main issues holding us from migrating a project from Prisma to Drizzle, together with full text search.
any updates here?
I am finding it very lacking. Why is this still not supported by december of 2023?
Describe want to want
I think having the ability to jump through relations without additional depth would be handy.
Given the following schema:
This is an over simplified example, but it shows the desired result.
So that we can jump through relationships and have them returned in the results itself. I offered two possible api designs but not sure which would be more effective.
Define "through" in relations and query using
with
No relation definition, handled in fn args
Prior Art
:through