You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This merged pull request describes the current logic for determining many-to-many relations. PR #1075
I updated to logic to only require the intermediate table of a m-to-n relation to be with
Exactly 2 foreign keys
A primary key formed by exactly 2 columns
Number of primary key equals to number of column
But it sometimes makes sense for these junction tables to contain more than 2 columns. For example, a CustomerProduct table that links the Customer and Product tables based on the products that each customer has bought, may have the following columns to record extra information about the relationship.
customer_id (foreign key)
product_id (foreign key)
price
quantity
purchase_date
promo_code
So, the requirement that the number of primary keys be equal to the number of columns should be removed.
The text was updated successfully, but these errors were encountered:
This merged pull request describes the current logic for determining many-to-many relations. PR #1075
But it sometimes makes sense for these junction tables to contain more than 2 columns. For example, a
CustomerProduct
table that links theCustomer
andProduct
tables based on the products that each customer has bought, may have the following columns to record extra information about the relationship.customer_id
(foreign key)product_id
(foreign key)price
quantity
purchase_date
promo_code
So, the requirement that the number of primary keys be equal to the number of columns should be removed.
The text was updated successfully, but these errors were encountered: