Issue with deleting liked songs from table using Supabase

13 views Asked by At

I'm encountering an issue with deleting liked songs from my database table using Supabase. I'm using Supabase for both inserting and deleting rows in my table, but for some reason, the deletion operation doesn't seem to work as expected.

I have a table named liked_songs where I store the associations between users and songs they've liked. Each row in this table represents a user liking a particular song, and it has columns user_id and song_id to identify the user and the song respectively.

When a user decides to "dislike" a song, I'm trying to remove the corresponding row from the liked_songs table using Supabase's delete() method. However, despite using the correct conditions to identify the row to be deleted (matching both user_id and song_id), the deletion operation doesn't seem to take effect.

I'm using the following code snippet to perform the deletion:

Snippet

However, even though there are no errors reported, the row corresponding to the disliked song remains in the liked_songs table.

I've verified that the insertion of liked songs works correctly, so I'm not sure why the deletion operation isn't functioning as expected.

Could someone please help me identify what might be causing this issue and suggest potential solutions?

In my application, I've implemented a feature where users can like and dislike songs. When a user dislikes a song, the corresponding record should be removed from the liked_songs table in the database. To achieve this, I've used the delete() method provided by Supabase.

I expected that when a user dislikes a song, the corresponding record in the liked_songs table would be successfully deleted from the database.

However, despite implementing the deletion logic as described above, the record is not being deleted from the table. I've verified that the conditions (user_id and song_id) are correctly specified, and there are no errors thrown during the deletion process. Yet, the record remains in the table even after the dislike operation.

0

There are 0 answers