Just curious to see your opinions, as I am developing a forum script alongside a coexisting CMS – which i have the ACL etc. sorted.
But was wondering if it is best to do DELETE FROM… (as in delete the record)…or just do an UPDATE to set a column to 1 (bool) – which hides it (so it looks deleted).
PS: only those who I trust have access to moderation tools
That’s up to you and usually a question of how important is the data you are deleting, or how tolerant you want to be with accidents.
The method I like to use is have a clone database for items you wish to delete. On delete, copy the contents of the selected row to new database, then delete. Having extra “deleted” articles or items in your system is just using up more space and eventually will slow down queries (potentially).
Once you fill up your “delete articles” database, run a dump, archive, truncate.
Let’s say you have the database CMS with a table called ARTICLES that you want to store deleted posts, we will create an identical database with the same table structure:
In your PHP script that’s deleting the content you would do something like this: