How to maintain record history
Hey, I'm looking for a bit of advice for how to handle history of tables that have foreign keys where the foreign keys data can change.
I'm working on a fitness app and have a table for every day you did a workout, which has a foreign key for a routine which has a foreign key for exercises.
For example, a routine can be changed. Initially, you have a routine which has pull-ups and you then remove that and change it to deadlifts, but you have already completed a few workouts before you make this change.
When you are viewing your history, I want it to be kept as it was when you completed that workout.
If I completed the initial workout on Monday then change it on Wednesday and complete an updated workout when I review my workout history, I want it to have:
"Monday: routine-1: pull-ups, Wednesday: routine-1: deadlifts"
Is this possible, and if so, is there a good way to implement this?
I'm working on a fitness app and have a table for every day you did a workout, which has a foreign key for a routine which has a foreign key for exercises.
For example, a routine can be changed. Initially, you have a routine which has pull-ups and you then remove that and change it to deadlifts, but you have already completed a few workouts before you make this change.
When you are viewing your history, I want it to be kept as it was when you completed that workout.
If I completed the initial workout on Monday then change it on Wednesday and complete an updated workout when I review my workout history, I want it to have:
"Monday: routine-1: pull-ups, Wednesday: routine-1: deadlifts"
Is this possible, and if so, is there a good way to implement this?