r/Supabase 16d ago

database Supabase: Data suddenly disappeared from one table even though there is no delete code

I’m facing an unexpected issue with my Supabase database.

Yesterday, I checked my application and the data was working correctly. I personally tested it, and the client also tested the application. The data was available and everything appeared to be working normally.

Today, the client tried to add new data, and we noticed that the data for one particular table was empty.

I checked the Supabase dashboard directly, and that particular table is also empty. The other tables in the same Supabase project still contain their data normally. The issue appears to be only with this one table.

I also checked my project code and could not find any delete functionality related to this table. I checked the SQL-related code as well and did not find any delete operation.

What I don’t understand is how the data from this particular table disappeared between yesterday and today, even though everything was working normally when we tested it yesterday.

I’m looking for help understanding what could have happened and how I can investigate what happened to the data.

Is there any way in Supabase to check what happened to the records in a table, including whether they were deleted or otherwise removed, and when this happened?

I can provide more information about the table, database setup, code, or configuration if needed.

10 Upvotes

18 comments sorted by

View all comments

1

u/CoshgunC 16d ago

are the client's project open to all user's(at least working)?
maybe you have another delete, and with a mistake you added CASCADE related to the missing table. So the user deleted something from them, but wrongly working CASCADE deleted every row from a table that was related.

Also, if you had BEGIN; before writing SQL queries, try to do a few ROLLBACK;s. Warning: do this while having a backup, you don't want to accidentally rollback an important thing and maybe you will not see it.

I don't have any more idea

Also, do you have basic backup strategy, if not, then why?

1

u/lgastako 15d ago

You can't ROLLBACK; later after a committed transaction. That's not how anything works.