…to stop messing up with knowledge updates, reminiscent of costs, titles, of the merchandise which are positioned in an order.
Specifically, a buyer buys three gadgets: for $5, $10 and $33 and pays for them. All is nicely. After I as an proprietor of a store step in and, earlier than I’ve delivered these merchandise to a buyer, determine to descrease the worth of the product, say, #2. Its new worth can be $eight as a substitute of $10. And I will additionally rename the product #three a bit of bit. A buyer then would go to a standing monitoring web page they usually’ll see up to date knowledge. Sure, they’ve paid and the order is being delivered, however the knowledge has already modified within the database. They will be consufed.
And so can be I in a yr after I will have modified the costs once more, renamed one thing, and many others… and determine to view historical past of the orders for a yr.
Query 1: is there a practise of constructing a snaphot of the present costs, names, whole order worth and different traits of the merchandise that represent an order, in addition to different particulars (chosen transport charge and transport methodology, taxes, reductions, and many others) for the time being when it is being positioned? Moderately than calculating these dynamically when an “order web page” is opened?
If sure, does it have a reputation? And are there suggestions of methods to do it correctly?
Query 2: the place and the way ought to I retailer a snaphot?
I would need to create a number of tables then:
and many others…
that may have the similar construction as their dynamics corresponding ones.
Laborious. Is there a greater means?
together with an order, within the “orders” desk. However how once more, given the truth that an order is a single row? As an illustration, the merchandise in an order is a listing. How would I retailer a listing with its traits (worth, weight, color, materials, what have you ever) in a row in such a means that’ll be roughly simple to retrieve sooner or later? Not as a string.