There is not enough information to infer relation. What am I doing wrong?
I have such a setup yet I'm getting
There is not enough information to infer relation "users.organizations"
. What am I missing? (below are all my relations)
It's a many-to-many relationship. I also registered all that stuff into the schema (below)
8 Replies
Also, unsure about
is
goodie 🙂
https://orm.drizzle.team/docs/goodies#compare-objects-types-instanceof-alternative
Can you show better example?Goodies – DrizzleORM
Drizzle ORM | %s
It looks like that's because your
usersRelations
are relating directly to organizations and vice versa instead of using
usersToOrganizations`
It should probably look something more like this:
then to query it you'll have to nest it like:
and you'll get:
It's a bit ugly 🙂 Would be awesome if it would be possible to have these many-to-many resolves more "magically" 🙂
I end up doing the changes that you mentioned and having a query like that.
that also works yeah! I agree it'd be cool to have it built in
@rip21 so glad you posted this, I'm dealing with the same exact thing right now. Any chance you're also using next-auth and trying to figure out how to redirect to an organization id dynamic URL path after signin?
Nope 🙂 I'm using supertokens.com for auth BTW. So far pretty solid.
man i just dont want to pay for auth lol
but maybe i should so i dont have to deal with headaches like this!!
If you have 5k MAU then it's a good problem to have 🙂
Beacuse it's free for that amount. If you have 100k etc so it costs a lot, then, well, again, you can always self-host making it cheaper 🙂