Let's suppose we have this relationship:
An example of my problem:
- A client comes to the store and buys a product for let's say 20$ and has a discount card with a reduction_rate of 5%. The database is going to register 20$ in amount and 19$ in amount_discounted.
Now let's say the discount_cards all drop the reduction_rate to 4% and the amount entered by the employee was wrong because he typed 21$ instead of 20$. It would be an error since the value of reduction_rate was 5% when the product has been bought. I don't know how to keep the value of the reduction_rate of a payement that has been done except by maybe storing the reduction_rate in the payements table but is this the "right way" to do this?
Thank you for reading.