one to many join table #1109
-
Hi everyone. I would like to ask is it possible to generate code for a one to many relationship modeled through a join table? I know that typically people model one-to-many relationships using a foreign key on a table that is supposed belong to another table. But I have a situation where I have a lot of tables that are mutually exclusive to each other but all of the rows of these tables can have many rows associated to them in one specific table, lets call that table "x". any row from these tables can only have multiple x's and no other row from the same table can have association to the same x's, thus, each of those other tables I'm creating, I would end up creating a join table for to associate them to that x, but at the same time I would enforce a unique(x_id) constraint in those join table, resulting in a one (any row from these tables) to many x's relationship that is modeled through a join table. I would assume that if the sqlboiler can enforce many to many and can support one to many using foreign keys, then it should be able to support one to many through join tables? Do you guys think this would be a possible feature to add? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think I can maybe understand what you're trying to explain, but for clarity can you share a minimal DB schema? |
Beta Was this translation helpful? Give feedback.
I think I can maybe understand what you're trying to explain, but for clarity can you share a minimal DB schema?