lundi 20 janvier 2020

Storing archive data like order in table or pivot table? Prevent from changes? MySQL

I have question about database design / storage pattern.

Example, we have tables: customers, addresses, products, orders and orders_products.

And now, customer pick order, what we store in order table?

  • pivot id to table customers ? raw customer data, like firstname, lastname etc ? what if customer change the data after order, we pivot to non-actual data?

  • that same situation with address?

  • in products, to prevent it change we transfer row to order_products, but what if other data?

I need tip, or pattern to use with situations like in sample. Thanks!

Aucun commentaire:

Enregistrer un commentaire