Let's imagine I want to store in a relational database the following :
- A list of quizzes
- A list of questions associated with quizzes
- A list of users
- The answers to questions made from users.
I could have a model like this:
However, this doesn't ensure any integrity in the following cases:
- A question has been modified so the corresponding answer is now wrong
- New questions are added to an existing quiz, so the score students will be different
With MySQL I don't know any way to prevent this kind of data corruption unless to put the database in read-only mode. The only alternative I can think of is to use a revision
column for both the quizzes
and the questions
. Then to use a composite primary key that identifies a question from its revision
and its id
.
My current idea is to have a JSON column in the activities
table that freeze the state of a quiz at a certain moment in time. Then the hash of this activity can be stored somewhere in a blockchain.
What would be the alternatives?