Reputation: 138
I'm wondering what is the best way to store content edits in a MySQL database?
I was first going to do something like Current_COMMENT, First_COMMENT
and have the original comment stored in first_COMMENT
and the latest comment (one that I would display) to Current_COMMENT
.
But then I realized it would be much better to store each commend edit so I could look back at all the revisions.
My question is, what is the best way to store this in the database? It would be nice if I could store a (almost)infinite amount of comment revisions.
Any help is much appreciated!
Upvotes: 1
Views: 133
Reputation: 6366
Use a column for create date, so you can utilize the history if need be. For the most recent comment, mark it with a flag column called current
. A simple int
will suffice: 1
for current, 0
for all others.
Upvotes: 2