← All guides

8 min read

How to back up a Supabase database properly

Most founders assume Supabase has them covered, until an AI tool runs a migration that drops a table, or someone deletes the wrong rows. Here's what you have, what you don't, and how to make a backup you control.

1. Know what you already have

2. Make a login that can only read

Don't back up with the postgres login: anything holding it can change or delete everything. Create a role that can read every table and nothing else. It needs to bypass row-level security, or the backup silently misses rows.

create role backup_reader with login password 'choose-a-long-random-password' bypassrls;
grant pg_read_all_data to backup_reader;
alter role backup_reader set default_transaction_read_only = on;

3. Dump it with pg_dump

Use the session pooler or direct connection string from the dashboard's Connect panel, with port 5432. The transaction pooler (port 6543) doesn't work for pg_dump. Use a pg_dump version at least as new as your database.

pg_dump "postgresql://backup_reader.<project-ref>:<password>@<pooler-host>:5432/postgres" \
  --format=custom --no-owner --no-privileges --file=backup.dump

4. Store it somewhere else, and test it

Prompt for your AI tool

Before changing my database schema or deleting data, write the change as a migration file I can review, list exactly which tables and rows it affects, and remind me to take a backup first. Never run destructive SQL directly.

Vern Backup does all of this every night

Nightly backups of your Postgres or Supabase database through a read-only login (Vern refuses one that could change data), stored in your own bucket, each one checked. Vern keeps only the record, never your data.

Who gets it: Pro, Agency and Vern Care

See plans