On my website, it is possible to write a comment. People can like this comment. But you can also write a reply to this comment and it is also possible to like the reply. For now, I have two tables to store my likes, with only one difference: the foreign key. The first one contains the foreign key 'comment_id' and the second one 'response_id'.
This obviously leads me to think that there is a better way to implement this, without multiplying my tables.
I found this post (Implementing Comments and Likes in database) that explains how, with generic types, you can like different entities. However, I don't see how this can be implemented in Supabase...
Do you know how you can reference your likes table to any other table in Supabase and thus make all entities similar? (a kind of generic foreign key) If not possible, is there a better alternative than mine ?