Foreign Key manual one to many generator
jmebones
Posts: 4
I am copying data between identical tables in a separate database.
I want the column foreign key generator to not be unique but still limited to ids in a third table. Right now the foreign key generator enforces a unique constraint on the column; one to one, I need a one to many relationship.
Thanks.
I want the column foreign key generator to not be unique but still limited to ids in a third table. Right now the foreign key generator enforces a unique constraint on the column; one to one, I need a one to many relationship.
Thanks.
Comments
I'm afraid I do not completely understand the issue. Can you provide a small sample of this schema? AFAIK the foreign key generator is like a foreign key - one-to-many. It would not make a lot of sense to make the reference side of the relationship be unique as the referenced side should be unique.
If i setup the foreign key on DeliveryAddress back to the participants table then it will only select unique part_id when a participant could have multiple delivery addresses.
There is a hint to the right of the "Population method" on the Foreign key generator UI stating: If the foreign key references a single column, each value in the referenced column is only used once. I have tested this and it creates a one to one foreign key.
e.g. A cart table with a TotalCost calculated from the products in the cart. If the data is being copied from another data source then the TotalCost is not valid.