I have a project where I have Products and SKU's. Each Product has one or many SKU's.
I also have Shops that can have many to many Products, So a Product can belong to multiple Shops and a Shop can have multiple Products.
To finish, each Shop can choose which SKU's they want for which Products. So I as a Shop can choose to sell the Tshirt White, which may have (XS,S,M,L) and I can choose (XS,S) as SKU's I want for my Shop.
Currently
As you can see A Shop is connected to the Products, and to the SKU's. But I have a feeling there's something wrong
My shop_skus and shop_products are not connected, So there can be a mismatch between the products a shop has, and the sku's..
How would I go about fixing that?
Thank you for your time!
shop_skus
toshops
and make it fromshop_skus
toshop_products
instead. You will also need to addproduct_id
inshop_skus
for this to work and a few more minor modifications (2 of the FKs will be composite). See a similar problem: Data inconsistency prohibition if a table refers to another via two many-to-many relationships and my answer there.