Answer the question
In order to leave comments, you need to log in
How to store the survey history correctly?
I am developing a survey system (magento 2).
Tables are currently planned for:
- Polls;
- questions for surveys;
- answer options;
- user responses.
It is also necessary to provide for changing the questions for the survey after there are already user responses. Namely, I would like to store the history of answers even for questions that no longer exist (for display in the admin panel).
There is an idea for a history table where there will be answers (and questions) in text form without reference to questions. Those. there is duplication in case of any changes in the questions.
Of the minuses: after any change, you will need to take all the answers of users and write them down again. It turns out to be very bloated.
ps I came up with the idea to save answers only for questions that have been changed or deleted, ie. like in git.
There is another idea: if there is a need to change something in the survey, you need to create a new one. In order not to suffer with stuffing the same questions, the table of questions is untied from polls and serves only as a dictionary from which you can take a ready-made question into a new poll.
Of the minuses: even with a dictionary, it is not as easy to change as in 1 case.
Pros: easy to store history, no extra tables even needed.
How to do it right?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question