Many-to-many relational query issues
schema, relations, statements: https://gist.github.com/kylewardnz/37104f989807e96555ea856294a2b670
1) executing the
but now it's all nested under another key. Not the end of the world, but it'd be nice if we were able to specify a relation on that pivot to pull from, something like:
Passing in
2) executing the
(figured I'd make another thread since this is unrelated to kit)
1) executing the
fetchArtistWithContent statement returns only the pivot table data on the members relation. This does make sense since it's actually a relation to that table, but logically I'm wanting the data from the members table. This can be done by changing the with statement to:but now it's all nested under another key. Not the end of the world, but it'd be nice if we were able to specify a relation on that pivot to pull from, something like:
Passing in
{ relationName: 'member' } as a second argument to many() (and vice versa on the inverse relation) results in There is not enough information to infer relation "artists.members" so I'm guessing this isn't the use case2) executing the
fetchAlbumWithContent statement results in a couple things:- the above issue on the
versions.photocardSetskey - this issue on all relations: https://github.com/drizzle-team/drizzle-orm/issues/599
then, I was wondering if there was a way within one query, to then append a new key calledalbumVersionIdsonto each record under thephotocardSetskey, which is just a list ofalbumVersionids that it's related to. This would be handy for being able to pass the record directly into an update form.
??? and I would guess this causes the n+1 problem too(figured I'd make another thread since this is unrelated to kit)