From my point of view, your fix in reality does not seems to fix it. Yes, you have incorporated standalone Category entity which is good thing, but lets say I have 10 categories named "cat1", "cat2", "cat3" ... "cat10".
With your fix, there are 3 tables
1) Installation table 2) Installation_Category table which has two attributes, "Installation_id" and "categories_id". 3) Category table, which has "id" and "name" attributes.
What it does right now is that "categories_id" in Installation_Category table maps to "id" in "Category" table.
When I have 1000 categories and I assign e.g. 50 categories from these 1000 to some installation, even I pick category with the _same name_, it is considered as totally new category.
So in the end, I have this in Category table:
{code} id name 1 cat1 2 cat1 3 cat2 4 cat1 {code}
I want it like this
{code} 1 cat1 2 cat2 {code}
So in that Installation_Category table I want it to have like this {code} Installation_id categories_id uuid1 1 uuid1 2 uuid1 3 uuid2 2 uuid3 1 {code}
instead of this
{code} uuid1 1 uuid1 2 uuid1 3 uuid1 4 uuid2 5 uuid3 6 uuid4 7 uuid5 8 {code}
In other words, category should be unique according to its name. It does not make sense at all to have multiple categories with same names - it solves nothing regarding perfomance and database storing effectivity since it generates new category every time.
If you do it uniquely, that would mean that if you delete some installation which belongs to some category, you would have to check if that category is not part of some other installation so you do not delete it because it is used somewhere else.
|