I want to store a blog post in a database. I thought it would be nice to have different versions of that data, much like version controlling does for text files.
So, I imagine it working like a row in a table, that had version control. So, for example, you could retrieve the latest version of that row, or a previous version. You could even branch from that row.
Does anything like this exist?
Possibly useful info:
I am currently using Python, Django & MySQL. I’m experimenting with MongoDB
Edit for clarity/more context:
I’m looking for a solution more tailored towards “version control” of rows than of databases; I’m not so much interested in branching entire databases. For example, I would be able to query the content of blog post at 1/1/2011 and at 1/1/2010 (without switching databases).
First off, I must say this is an interesting question.
In my line of work, I’ve to save versions of various user inputs. The way I do it, and by all means I don’t really know if it’s the right way or not, is the following:
I have a
mastertable andrevisionstable. I chose these 2 names for the example’s sake only.What master does is stores the following info:
What
revisionsstore is the following:What I achieved this way is that I had gotten an ID of, let’s say a blog post. If someone edits the post, I’ll store that info to
revisionstable. Via triggers I’m incrementing theversion_idinrevisionstable. After that I updatemastertable with the latestversion_idnumber. That way I don’t have to performMAX()when I want to see what the latest version is.That way I obtained simple, yet powerful version system of website’s content. It’s easy to see changes, and it’s also extremely fast to obtain data if you abuse some MySQL cool features (in my actual tables, I’m abusing InnoDB’s clustered primary key to the max. so the db design is slightly diff. than the one I posted here).