Answer the question
In order to leave comments, you need to log in
Versioning and data moderation?
Hello!
There is a table for storing user data with such columns
id<br/>
*name<br/>
*surname<br/>
jabber<br/>
skype
Answer the question
In order to leave comments, you need to log in
As far as I understand, the case that confuses you most of all is when the user has changed the moderated field, the moderator has not yet had time to confirm, and then the user has changed the unmoderated field and is waiting for this change to appear immediately. In this case, I see no other option than 3, that is, separate storage of moderated and non-moderated fields. The change in logic is minimal.
What revision atomicity are we talking about, what case are you considering? When did the user change both moderated and unmoderated fields on the first visit, and only unmoderated fields on the second visit? It is precisely with joint storage (options 1 and 2) that ambiguity will arise, that is, if the moderator confirms change 1, then which record data should be considered relevant? There are two options - to enter into the record at the second change in the moderated fields either the original data or the data from the first change. The first option breaks down if the moderator confirms the post, and the second one fails if it doesn't. I hope I have explained well.
I will describe how it was done in one of the systems that I am finalizing.
There are two tables:
Main - stores the most recent version of the record in the field set.
Correction table - stores the same set of fields + Date of change, user (who made the change), and a flag that the record was deleted. In your case, it is worth adding a flag to the second table that the data is confirmed.
Thus, in the main table, you get the most up-to-date state of the record.
And in the history table you can see which field and what was changed at what point. At the same time, for each version of the record, you can find out whether there was a confirmation.
Depending on the tools:
* see Partitioning - the database will do everything by itself
stackoverflow.com/questions/102278/active-flag-or-not
* The 2nd option can work with tables with the same fields to make life easier
Option 2 is the best.
In order to avoid collisions of the type that you mentioned, it is enough to store only the changed field / fields in one entry in the revision table, and the rest are NULL.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question