— 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 unravel this (options) 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’ll be able to see a
fresh_product consists of
Then after I place an order, the
order id and
order_status can be saved in
order desk. All of the ordered gadgets can be saved within the
order_item desk. In
order_item desk you’ll be able to see I’ve a direct reference to the
At sure instances, the administration will resolve to vary the present
fresh_products. For an instance, lets take fish merchandise reminiscent of Tuna. This fish merchandise has a class known as Loin(fished with Loin), after someday administration resolve to take away it or rename it as a result of they now not fish with Loin.
Now, my design can be affected due to the above change. Why? Whenever you make a change to any of the
fresh_product fields, it should straight have an effect on the
order_item which holds the data of already ordered gadgets. So if you happen to rename
Loin , all
order_items which has
Loin will now be linked to the brand new title which is flawed. Should you resolve to delete a
fresh_product you’ll be able to’t do this both, as a result of there are present order historical past certain to that
- As an answer for this downside, I’m pondering 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 similar time, any
fresh_productmerchandise can undertake any change with out affecting already bought gadgets at
As I do know, that is known as Knowledge Warehousing. When looking web, I discovered posts like this encouraging this follow. –
- The second suggestion is, maintaining my above design as it’s. The person will be unable to delete merchandise, as an alternative he’ll be capable of conceal them from person. As soon as entered, merchandise data reminiscent of
measurementshouldn’t be capable of change (I feel they should not be modified anyway). As an alternative conceal the merchandise linked to that
measurementand so forth. If a small change like a typo, they’re free to make it and they need to know it should 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 information redundancy. Additionally some strongly imagine if you happen to insert a product to a system, you shouldn’t change, as an alternative it is best to conceal it and add a brand new one.
My query is, which of my suggestion is the easiest way to unravel this subject? When you’ve got higher options, I’m open.