Skip to content
ReviveDB
Blog

How to restore a deleted table or row in Supabase

By ReviveDB

Whether you can get a deleted table or row back in Supabase depends on one thing: whether a copy existed before the deletion. Supabase keeps no separate copy of deleted data, so the answer comes from your plan's backups, from PITR, or from a copy you made yourself.

First, stop the damage spreading

  • Pause whatever deleted the data: a migration, a script, an AI prompt or a cron job.
  • Note the time of the deletion as precisely as you can. Every restore option starts from that moment.
  • Do not restore over the live database yet. An in-place restore also removes everything written after the backup.

On the free plan

Supabase documents no automatic backups for free projects. Some users report that recent daily backups appeared after they upgraded to Pro, but that is undocumented, so ask support before you count on it. Otherwise recovery is only possible from a copy made before the deletion, such as an earlier pg_dump or a CSV export. To make sure there is one next time, see how to back up Supabase on the free plan.

With daily backups on a paid plan

Paid plans keep a daily database backup, 7 days on Pro and 14 on Team. Restoring one in place rolls the whole database back to that moment, so every row written since is lost as well. For a single table, restore into a new project where your project supports it, and copy the table back. See how to restore a Supabase backup to a new project.

With PITR

With the PITR add-on you can pick a moment just before the deletion, down to seconds. The same advice applies: restore into a new project and copy back only what is missing, so the rest of the database keeps today's data. For what PITR costs, see Supabase PITR pricing.

Copying one table back

Once the restored copy runs, take only what is missing:

  • For deleted rows, export them from the restored copy, for example with pg_dump --data-only --table=public.orders. Load them into a temporary table in the live project and insert the rows whose ids are missing.
  • For a dropped table, export structure and data with pg_dump --table=public.orders and load it into the live project.
  • Check what the table depended on: foreign keys, sequences, RLS policies, triggers and grants. A dropped table takes its policies and triggers with it.
  • Compare row counts with the restored copy before you delete the temporary project.

What a database restore cannot bring back

If the deleted rows pointed to files in Storage, the files themselves are not in a database backup. Restoring storage.objects rows recreates the file list, not the files. See do Supabase backups include Storage files.

Next time

Keep a copy outside the project that you have restored at least once, so a deletion becomes a question of picking a moment. ReviveDB keeps recovery points of the database and Auth, Storage files and Edge Functions in the EU, restores every database backup as a test, and restores into a new project. Your live project is not affected.