Jump to content

Best way of saving a post data as history if its updated.


zid

Recommended Posts

Hi,

If I want to let users update a post (title or text), what would be the best approach if I want to preserve the original data as browsable history?

 

Example:

Original Post containing tables: post_id, post_title, post_text, post_author

 

If a user want to Edit/Update this post:

- the new input should replace the post_title and post_text (preserving the post_id since it got comments associated with it).

- the old input should be posted as a new history post, with a new post_id, old post_text, old post_title and have a refferal to the original post_id.

 

Is this a good approach or should I go for something else?

Your example would be pretty bad, if you just have a while to go through all posts made, and show them on for example your frontpage - then it would both show the new and old version of the post.

 

You could add a new table, for history posts, or you could add a new column in your existing table, called something like post_history, and then only, on your frontpage, show post where post_history == 0.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.