Hey, i am looking at a problem and I can't find a ...
# orm-help
j
Hey, i am looking at a problem and I can't find a proper solution for this. I have a schema which stores a number of Products with a price. When someone saves an order, I save the order with a relation to the specific Product. So far so good, but whenever the price of the Product changed with an update, I don't want the price of the product within the order to change. My best guess is, I would need to implement some kind of revisioning with Products. Am I on the right track or should I look at a different route?
s
You need to replicate the price on the relation
j
I'm dealing/planning something similar and my solution is to create a 'calcified' order that takes all the information about a Product at a certain point in time. My thoughts are that as soon as an Order is created with a Product, the Order can no longer depend on Product state to stay the same. So all pertinent Product info at that point in time needs to be saved onto the Order record itself.
👍 1