Use the CLI, it wraps pg_dump with the right flags for Supabase:
supabase db dump --db-url "$DB_URL" -f roles.sql --role-only
supabase db dump --db-url "$DB_URL" -f schema.sql
supabase db dump --db-url "$DB_URL" -f data.sql --use-copy --data-onlyThat gives you roles, schema (tables, functions, policies) and data. Use the session pooler URL if your network doesn't do IPv6.
Three things people forget:
- Storage files are not in the database dump. Only the metadata. Photos need a separate copy.
auth.usersis in the data dump. Treat the files as sensitive, don't leave them in Downloads.- A backup you never restored is a hope, not a backup. Restore it once into a local Supabase (
supabase start, thenpsqlthe files in) and click around.
Once you pay for Pro you also get daily backups in the dashboard, but keep your own copy anyway.