If you only need to add "like" functionality then you can remove the liked
column from your table. As you said if a user likes a image you are going to add a new row to likes table, but if you want to add "dislike" feature in the future then you need the liked
column. In that case if the user likes an image you add a new record with the liked
column set to true
and if the user dislike an image you add a new record and set liked
column to false
.