Revision history allows you to see what was revised, who made the revision, compare two revisions, and revert to another revision if necessary.
Why is Version Control Important? Version control is important when documents are being created, and for any records that undergo a lot of revision and redrafting. It helps us to track changes and identify when key decisions were made along the way.
What is version control? Version control is the process by which different drafts and versions of a document or record are managed. It is a tool which tracks a series of draft documents, culminating in a final version. It provides an audit trail for the revision and update of these finalised versions.
After reading a lot of SO questions about Keeping page changes history or How to version control a record in a database (for example), I can't find a real elegant solution to do the work.
Now, let's try to explain as clear as possible what we need, for this simple revision system, that allows registered users to post some articles, and other users to submit a revision of those articles, and then some moderators users to check those revisions.
MySQL database
The database contains an articles table with the following simplified fields:
ARTICLE(id, id_user, title, content, date);
To implement the revision/history versions, I guess that we'll have the following table:
REVISION(id, id_article, revision_id_user, id_moderator, revision_date,
revision_title, revision_content, revision_description, revision_check);
With the relation : ARTICLE 0,n <---> 1,1 REVISION
Workflow
A user create an ARTICLE
, which is inserted in the ARTICLE
table (terrific !)
Another user makes an update of this ARTICLE
, this update is recorded in the REVISION
table, and is queued for the moderator users. (revision_check=0
).
A moderator user validate the REVISION(revision_check=1)
, then the ARTICLE(content)
gets the REVISION(revision_content)
value.
My questions
REVISION
s for an ARTICLE
:REVISION
or the original ARTICLE
?REVISION
could be submitted while the last isn't checked.Is there a way to record light versioning? By the way, is it possible to insert in the REVISION
table, only the updated content through a SQL, PHP or js compare function? And how to display it like SO do it? Because I'm afraid that the REVISION
table will be very heavy.
Bonus : how does SO?
Any idea, link, source, plugin (MySQL, PHP 5 and JS/jQuery) would be greatly appreciated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With