Reputation: 517
I'm creating a social network,
Question: In a post, anytime an user wants to delete this post or a comment. Do I need to delete it from the database or just change its status in order it doesnt appear anymore and give the user the feeling its already deleted?
Example:
<button>Delete this comment</button>
SQL
DELETE FROM table_posts WHERE...
OR
UPDATE table_posts SET status="deleted" WHERE...
Which one is more suitable?
Upvotes: 0
Views: 399
Reputation: 376
It depends...
There are two cases:
If you delete the record:
If you update and set the status to "deleted":
What is the best? This will depend on your business rule.
Upvotes: 2