I have an application that processes and stores orders. Each order is composed of line items that have various things like pricing, sizing, colors, etc. My question is how do I persist that data over time without tying it to underlying data that is subject to change.
For example, someone orders something which is composed of 5 things that cost $1 each, for a total of $5. However, at some point in the future the costs for the individual things changes to $0.50. Now when I bring up the old order it's total cost is $2.50 instead of $5.
Initially, I thought of just not allowing the children tables to be updated, however that is not really feasible as the pricing is based on huge pricing grids that the customer only wants to update and not create new ones every time a price changes in the slightest. Each pricing grid take hours to set up and the pricing changes every couple of days.
Another thought is to serialize the entire order and work from that. However, that makes it hard to update the system and change anything. Old orders will no longer display properly and might even crash the system.
This is a pretty general problem and I'm looking for a best practices viewpoint.