— I do know related questions have been requested earlier than. However this isn’t a replica. I didn’t discover my reply in different posts. In right here I’m asking about modifications to “merchandise” which I didn’t see in different direct questions. Then right here I current 2 methods to resolve this (strategies) which weren’t mentioned in different threads. —
I’m growing an app for ordering merchandise on-line. I’ll first current you part of the ER Diagram after which clarify.
Right here the “merchandise” are meals gadgets and they’re going to go contained in the
fresh_products desk. As you possibly can see a
fresh_product consists of
Then after I place an order, the
order id and
order_status might be saved in
order desk. All of the ordered gadgets might be saved within the
order_item desk. In
order_item desk you possibly can see I’ve a direct reference to the
At sure occasions, the administration will determine to alter the present
fresh_products. For an instance, lets take fish merchandise comparable to Tuna. This fish merchandise has a class known as Loin(fished with Loin), after someday administration determine to take away it or rename it as a result of they now not fish with Loin.
Now, my design might be affected due to the above change. Why? Once you make a change to any of the
fresh_product fields, it would immediately have an effect on the
order_item which holds the data of already ordered gadgets. So for those who rename
Loin , all
order_items which has
Loin will now be linked to the brand new title which is mistaken. For those who determine to delete a
fresh_product you possibly can’t try this both, as a result of there are current order historical past certain to that
- As an answer for this drawback, I’m considering of eradicating the connection of
order_item. Then, I’ll add
order_itemrepresenting all fields of
fresh_products, for an instance
prodyctCategoryand so forth. Now I haven’t got a direct reference to
fresh_productshowever have all the data wanted. On the identical time, any
fresh_productmerchandise can undertake any change with out affecting already bought gadgets at
As I do know, that is known as Information Warehousing. When looking web, I discovered posts like this encouraging this apply. –
- The second suggestion is, protecting my above design as it’s. The consumer won’t be able to delete merchandise, as an alternative he’ll have the ability to conceal them from consumer. As soon as entered, merchandise data comparable to
measurementshouldn’t be capable of change (I believe they should not be modified anyway). As a substitute conceal the merchandise linked to that
measurementand so on. If a small change like a typo, they’re free to make it and they need to know it would have an effect on every thing related.
When googling, I discovered this mechanism additionally been backed by many, as a result of there isn’t a knowledge redundancy. Additionally some strongly consider for those who insert a product to a system, you shouldn’t change, as an alternative you need to conceal it and add a brand new one.
My query is, which of my suggestion is one of the simplest ways to resolve this concern? When you have higher options, I’m open.