#(Beginner) Is my schema with one-to-many and many-to-many relationships wrong?

3 messages · Page 1 of 1 (latest)

grand burrow
#

Hi, first message here.

I have a model Individual with a relationship parentFamily: Family, and a model Family with relationship father: Individual and mother: Individual, as well as children: Individual[].

It seems logical to insert the Individuals first with a createMany query, and after that the Families with a createMany (I know fatherId and motherId).

However, I cannot connect the children part with the createMany (it would require to use connect, or that the Family is inserted when I create the Individual). Because I have a lot of data, it would make sense to use createMany.

Is my data modeling wrong ? Is there a way around it?
I know all the ids in advance.

blazing trench
#

i'm lazy to read this shrug

grand burrow
#

😰 . I tried to give as much context as possible, but basically: how to bulk insert data into two tables, with bi-directional relationships?