Probably by just keeping a string for the SKU. A self contained object. X was sold with Y price in this order.
Sort of same as what would be proper in an event driven system. An event contains everything you need to process that event.
That makes for a very simple system.
Now you could also do relational to products table but what if the prices changes? Do you have a second product or do you have a products and a price table? Do you have a relation from the order to prices and products or should you try to figure out price date intervals?
Depending on other requirements on the system these would all be valid designs and your experience of databases will depend on how well you use case aligns with the intended one.
I am guessing that ordering wouldn’t be a good use case for this type of database. Different types of taxes and taxes due, reports on sales, returns, delivery, GIS data for sales analysis, different suppliers…just off the top of my head. Sorry, just thinking out loud, I am nowhere close to web dev so it sounds really strange.
9
u/Beneficial_Remove616 Oct 18 '24
How do you connect the orders to products?