Hi everyone I have a specific requirement from the client. we have an order table that contains all the information related to order such as calculations. The order table has hasMany relationship with order items just like a regular order database structure. After order fullfilment many fields from order table and order items table will be changed now client want to see the original order which was placed as new. Please guide me what is best approch for that.
@Tray no lets say i have a order which has 2 items and grand total of 100. then user edited the order now order has 4 items and 200 total. we want to see original order with calculations
@ziarv Ah, ok so you are talking about some kind of versioning of the order?
I would probably use database triggers for that, to copy the relevant information to a log table. or maybe add a version to the orders table, and use that to show what is needed.
@Tray2 yes this came to my mind like there will be a order_history and order_item_history table but is that a good approch because they have lot of orders its a ERP system
@ziarv Why JSON? Store data relationally in a relational database. Don‘t just smash it in a JSON blob.
Unfortunately, you can’t magically store things without it taking space. Of course the more data you store, the larger your database becomes. Rows should only be a few bytes in size, though.