tags:

views:

41

answers:

1

I love the way SO retains the edits to Q/A's and allows us to roll back if need be.

I'm looking for a DB structure concept on how to implement something similar to this. Can anyone give any insights?

My current solution is to have two tables like so...

Table1  
ID   |   Date   |   UserID

.

Table2
ID   |   Table1ID   |   UserID   |   Title   |   Details
+2  A: 

There are multiple ways to implement this. You can start by looking at the MediaWiki schema. See in particular the Revision, Page, and Pagecontent tables.

I believe StackOverflow's design is similar. However, according to this blog post, the StackOverflow devs ran into scalability issues with part of the design.

Matthew Flaschen
If I'm reading that schema right, then my idea to have two tables should be on the right path then. **Table1** (`Page`) and **Table2** (`Revision`)
rockinthesixstring
Also, would you keep a whole entire revision, or some how parse out the changes in order to save space?
rockinthesixstring