Ask HN: How to version control DB data?
What are the standard/recommended ways to store version-controlled, database data? I'm curious about solutions that would enable querying on tables/rows but restricted to those values at a certain point in time.
Fyi, I have posted to SO, with little satisfaction: http://stackoverflow.com/questions/8522766/what-are-the-standard-recommended-ways-to-store-version-controlled-database-dat
9 comments
[ 3.5 ms ] story [ 27.5 ms ] threadI'd re-examine your requirements on this one. You normally wouldn't be doing intense revision control directly inside of the database
At a high level, you could just keep a record of every version of every blog post, then separately maintain which entry is most current, or active, or whatever metric you want to display/query. This will let you maintain all versions of the blog post and you can run diffs on different versions, revert to older versions and branch from any version.
1. Insert the new row
2. Find the previous row
3. Set previous row to `active`=0
Are there performance tricks to keep this reasonable? I'd also wonder how to modify the table itself (dropping/adding columns) when there would potentially be selects + inserts + updates running 100% of the time - but I realize that's borderline out of scope of the OP's question.