ManyToManyRelation Relatioship - 1 parent table 2 entries in relatioship table #2465
Unanswered
codingwithswapnil
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For relation from A to B via C, we can have relation as ManyToManyRelation.
In out example, A and B table are same
relationship: {
relation: Model.ManyToManyRelation,
modelClass:
${__dirname}/A
,join: {
from: 'A.uuid',
through: {
from: 'R.item_uuid_child',
to: 'R.item_uuid_parent',
extra: [
'A_uuid_child',
'A_uuid_parent',
'relation_p_to_c',
],
},
to: 'A.uuid',
},
}
Now, in our usecase, we can have 2 entries in R table while 1 entry in A table. Will that be feasible from objection to manage? Right now, its creating another entry in table A automatically if I tries to do POST.
Appreciate your support!
Beta Was this translation helpful? Give feedback.
All reactions