I am creating a database for a program where I have to model some relationships in the family. for example: X - father Y, Y - son X
So, I have a Members table with all the information about each member, so I thought about making many, many relationships between the Members table and myself, so that Member_Member will have the columns "FK_FromID, FK_ToID" as compound (is this correct?) And "FK_RelationType" as a foreign key to the RelationTypes table , which will have the relationship type "Father, mother, son, daughter" and two relations, going from one to many from the "Participants" table to these two foreign keys
My problem: when deleting, if I choose cascading, then I will do loops, because if I delete the element, then there will be two deletion of passes to the related entries in the Member_Member bridge , knowing that in the program whenever I insert relationships with father, I’ll also insert the son’s relationship in the Member_Member table, is there a way or workaround to enable cascading so that whenever I delete a member, I delete the related entries in Member_member regardless of whether they are written in column a or from an external the key
So, I don’t know what to do, is it the right design in the first place or what ?, what should I do with cycling, also, what do you think, the best design for the same problem should know that I need to indicate what is the relationship between the two sides
Thanks so much for any help and sorry for the bad english bishoy
source
share