VibecodingKeeping it workingLevel 2: Context

How Do You Back Up Your Database and Prove It Restores?

Find out what your plan actually backs up, add your own export if it isn't enough, and restore a backup into a separate project at least once. Also keep your AI tool away from production data. A backup you've never restored is only a hope, and code rollbacks don't bring deleted rows back.

Prompt to copy
Set up backups for this project. Database: [Supabase on the Free / Pro plan, or other]. Don't touch production data, and never run anything destructive against it. Show me each command before running it.

1. Tell me what my current plan backs up, how long it keeps backups, and what isn't covered, such as stored files. Say where to confirm this.
2. Write a script that exports three separate files:
   supabase db dump --linked -f roles.sql --role-only
   supabase db dump --linked -f schema.sql
   supabase db dump --linked -f data.sql --use-copy --data-only
   Check Supabase's backup guide for any tables it currently excludes. Date the files. Never commit them to Git, since they contain real user data. Add the folder to .gitignore. Tell me where to store them safely, encrypted, off this machine.
3. Back up my stored files as well: [list buckets].
4. Write restore steps for a NEW empty project only, using:
   psql --single-transaction --variable ON_ERROR_STOP=1 \
     --file roles.sql --file schema.sql \
     --command 'SET session_replication_role = replica' --file data.sql \
     --dbname [NEW_PROJECT_CONNECTION_STRING]
5. Give me a checklist to verify the restored copy: row counts, a test sign-in, and access rules still working.
6. List what the restore doesn't bring back, such as edge functions, secrets and auth settings, and how I would recreate each.

Also check that no tool or script I use for development connects to production, and tell me how to separate them.
  • Pro7 days
  • Team14 days
  • EnterpriseUp to 30 days
Daily backups you can access on each Supabase plan. Free projects can't download backups. Source: Supabase docs, checked November 6, 2026.
  1. Jul 18, 2025Founder says Replit erased his databaseIt happened during a code freeze, he says
  2. Jul 21, 2025Replit separates dev and productionSeparate databases announced
  3. Apr 27, 2026Cursor agent deletes production, founder saysDatabase and volume backups, in nine seconds
  4. Apr 29, 2026Railway adds 48-hour soft deleteThe customer data was recovered
Two agent incidents, as reported by those involved. Sources: Jason Lemkin's post and Replit's blog, July 2025; The Register and Railway, April 2026. The second was a developer's agent task, not strictly vibe coding.

Try it now

  1. 1Check your plan: in Supabase, open Database → Backups. On Replit, check your plan's restore window. If you see nothing listed, assume you have no backup.
  2. 2Run the export script from the prompt on your own project, and save the files somewhere that isn't your laptop or your Git repository.
  3. 3Create a new empty project and restore into it. It worked if your row counts match, a test account can sign in, and the two-account access test still passes on the copy.

Use it when

Before your first real user, before any risky database change, and on a regular schedule after that. Match the schedule to how much data you can afford to lose: daily if losing a day would hurt.

Skip it when

An app holding only sample data, or data you can easily recreate, can wait. Don't pay for point-in-time recovery on a small app that a daily export would cover. Supabase suggests it mainly for databases over 4 GB, or when you need a shorter recovery window.

Why it works

The defaults vary a lot, and the free ones may not cover you. Supabase's docs say Pro projects can access 7 days of daily backups, Team 14 and Enterprise up to 30. Free projects can't download backups, and Supabase recommends exporting regularly with supabase db dump and keeping copies elsewhere. Point-in-time recovery is an add-on, with a worst case of two minutes of lost data, from about $100 a month for 7 days.

Backups have gaps as well. Supabase's database backups don't include files in Storage, since the database only holds their metadata. Its CLI restore guide also leaves out edge functions and customizations to the auth and storage schemas.

In builders, code and data have separate undo paths. Lovable's revert leaves data as it is. Replit's pricing page lists database rollback of up to 28 days on Pro. Replit also says Agent reads production through a read replica and can't change it directly, which is the kind of separation you want everywhere.

Example

A small booking app runs on Supabase's Free plan, with 300 real customers. The owner assumes backups exist. They don't exist in any form she can download. An AI session then runs a migration that removes a column it thought was unused.

With a weekly export, she could restore into a new project and copy the lost column's values back. Without one, the data is gone. So she sets up a scheduled export, restores once to prove it works, and moves to Pro for daily backups. She also splits her work: the AI's connection now points at a Supabase branch, which has its own database and API keys, and doesn't copy production data unless she chooses to.

Going further

Restoring has side effects. Supabase says the project is inaccessible during a restore and that downtime scales with database size. A point-in-time restore replaces your current state, so restore to a new project first if you need to keep recent data. Enabling point-in-time recovery also stops daily backups.

Keep the AI away from production. Use separate credentials for development, and don't leave a production connection string in a local .env. In Claude Code, deny rules can block reading those files. On Vercel, set different database values for Preview and Production. Replit flags risky changes in the Publish pane, such as removing columns with data, and offers **Create preview deploy** for testing them on an isolated copy.

Backup files contain every user's data, so treat them like production. Encrypt them, limit who has access, and delete old copies on a schedule that fits any rules you're under.

Common mistakes

  • Assuming your host backs everything up. On Supabase, the Free plan's data isn't downloadable and files aren't in database backups.
  • Keeping exports in the Git repository, where every clone gets a copy of your customers' data.
  • Testing a restore on the live project. Always restore to a new, separate one.
  • Giving an AI agent a production database connection for convenience. One wrong migration can then reach real data.

Sources

Checked 6 November 2026. Products change often, so confirm details with the vendor.

Related

Beyond the course