#On SQL is it better to hard delete or soft delete likes?

8 messages · Page 1 of 1 (latest)

lean vigil
#

Hey guys, I'm designing a database for a basic social media app and ran into this issue:

I have a likes table with a foreign key of user ID and post ID, and was wondering if when a user unlikes a post:

Should I:

  • Completely remove the like at the unlike action
    OR
  • Set a T/F flag for likes that were already made. So if a user unlikes, the like they made with that specific post gets marked with F until they like it again.

I would assume deleting it and making a new one is the correct path, but I'm also not sure about how it can impact performance or data integrity.

Thanks in advance!

hollow quail
#

I'd probably hard delete likes

Generally speaking you probably don't want to delete important things, so user accounts etc. should be soft deleted

lean vigil
#

Will do so 💯

royal cove
#

Yup same as rob said.
Allways matters on the case, but in your case its an tempory entity. so can go poof^^

zinc copper
#

I'd be an evil prick and force them to dislike something to undo a like, since if they engage it should be one way or the other vs. allow them to revert to "not engaged"?

hollow quail
#

Dislikes were invented by haters.

zinc copper
#

(*Totally ignoring situations where someone drops a tablet, has a pet, or let's a child play with a device that's not turned off properly.)

#

I am a fan of not showing the dislike counter. It's sort of like hiding the names of domestic terrorists. We want to be aware of a problem without the effort encouraging problems?