one-to-many self reference
Hello guys,
this is a simplified section of my schema:
contacts are families or family members, where parent_id points to the family
I tried to update the above code:
but I'm getting this error:
and also have this:
even without the .references, the below code silently fails:
4 Replies
@JP Hey! You can write this, but it's the same as the first code section above:
https://arc.net/l/quote/wofibpcw
When you have multiple relations between the same two tables you need to specify
relation_name
for them
https://orm.drizzle.team/docs/rqb#disambiguating-relationsThank you @⚡Z.E.U.S⚡!
this worked:
I'm not sure if it's right, but it doesn't show errors, so, nice!!
Also this code does not show any error:
but this code below fails with
There is not enough information to infer relation "contacts.familyMembers
I saw this, I'll try to fix itYou need to specify
one
relation too:
but I don't know in this case which is the 'other side' of the relationship 🙂
I'll try that right now!
Thank you @⚡Z.E.U.S⚡! it's working. I've been struggling with this for hours!