How should I design two models `A` and `B` so there is a 3rd table that associate many rows in `A` to one row in `B`?

Viewed 34

(This question is specific to go-gorm. I know how to do this in raw SQL.)

Let me put my question in this over simplified form:

Say I already have:

  • table A, say kids
  • table B, say moms

NOTE: I am not allowed to change each structure.

How do design these two modles, such that it end up another table bond where each row is a kid_id and a mom_id?

Thanks

0 Answers
Related