Here are my notes / opinions on this subject. You are missing power, but I will do my best to guess them.
providing each record with a unique identifier is more reasonable in many ways: it is faster to search in one field than two, it is safer to delete, etc.
What search will you do on this id? The queries you will run are: "Get all categories for an item" and "Get all items for a category." I do not understand why it would be safer to delete. However, I would add that adding id
may not be compatible for insertion, since you may have different identifiers, but the same category_id and item_id pairs. You will need to check the restrictions there and make sure that the pairs are unique (and not what the PCs are used for)?
items
are ok ... (see comments below)- Remove
id
from item_options
(in the same case as above, and see comments below) option_types
ok
Now, I think that the relationship between items and parameters will require more thought. This seems to be a many-to-many relationship. As an element, such as a T-shirt, can have many sizes, it makes sense to say that each pair and parameters should have a different size. But what happens when, in addition to size, you also have other material, such as cotton and leather. You will need to get information on pairs of cotton-S, cotton-M, cotton-L and leather-S, leather-M and leather-L. This makes sense, as I am sure that they will all have different prices and weights. But now add 2 colors to our t-shirts. You will need to add price and weight for each of the 12 combinations that we have now.
Not to mention that if the user would like to see the price of the product, he will have to choose all the options until he reaches the price. I am not sure how this should be done, since I do not know about requiremets. I just give up the idea: you can apply prices and weight variations at the base price and weight, which will be part of this element.
Just some raw thoughts before going to bed:
option_types
may be some kind of hierarchy- Carefully think about how you will handle
stock
with this design in mind. You will have 10 items for the Black T-Shirt ... but how many items do you have for the black leather T-shirt? How is this number related to 10 original ones?
source share