~/guides/BACKUP.md

Guides / Build apps

If AI wipes your database, you can still get it back: a test database, automatic backups, a monthly restore

Last year Replit's AI wiped a production database during a code freeze. Three habits make it recoverable: a test database, automatic backups, a monthly restore.

Coding with AI is fast, but one command can also empty your database. This is the full version of my BACKUP reel: two real incidents, three habits, and where to set them up in Supabase. The incidents and plan details were checked against the original sources on 30 Oct 2026.

01The result: the database is wiped, and you get it back

Reel frame: blue database discs back on the PROD pedestal, a BACKUP crate, Claw'd and a restored stamp
Illustration: the database is wiped and flies back out of the backup crate. Real recovery takes 3 habits.

Even if AI really does delete your database, three habits turn the damage into "one restore" instead of "the whole product". None of them need code; they're settings and routines.

What you get from this guide:

  1. Two real incidents: an AI wiping a database, and backups that all failed.
  2. Habit 1: keep AI on a test database, with a prompt you can paste.
  3. Habit 2: where Supabase's automatic backups live, how long each plan keeps them, and how to export on the free plan.
  4. Habit 3: a monthly restore drill, step by step.

02Why bother: AI really does delete things

According to Fortune, in July 2025 SaaStr founder Jason Lemkin was coding with Replit's AI under an explicit code-and-action freeze, and the AI still deleted the live production database, with records for more than 1,200 executives and over 1,190 companies. The AI itself called it "a catastrophic failure". Replit's CEO then promised automatic separation of development and production databases.

03① Keep AI on a test database

Reel frame: a padlock on the blue PROD stack, the green TEST stack beside it, Claw'd in between
Lock production; AI only touches the test database.
  1. Run two databases (or two Supabase projects): one for development and testing, one for production.
  2. Your local .env holds only the test database connection.
  3. Keep the production password and connection string in your hosting platform's environment variables, never in code or in files the AI can read.
  4. In Claude Code you can also add a Read deny rule for the file that holds production secrets; see my ALLOW guide for the syntax.
Ask the AI to split the environments (replace the [])
Split this project into two environments: development uses [the test database], production uses [the production database]. Read the production connection string only from the hosting platform's environment variables, never from code or .env. Before changing anything, list the files you plan to edit.

04② Turn on automatic backups

Reel frame: the Supabase Database Backups docs with the daily-backup and 7-day lines boxed
Supabase docs: Pro, Team and Enterprise are backed up daily; Pro keeps 7 days (screenshot 30 Oct 2026).
  1. Supabase backs up Pro, Team and Enterprise projects automatically every day.
  2. Retention: Pro keeps the last 7 days, Team 14 days, Enterprise up to 30 days.
  3. Backups live under Database > Backups in the Dashboard; pick one to restore.
  4. For finer than daily, add Point-in-Time Recovery (an add-on on paid plans).
  5. Free projects don't get daily backups. The docs recommend exporting regularly with the Supabase CLI db dump command.
Export it yourself on the free plan (run in a linked project folder)
supabase db dump --linked -f schema.sql
supabase db dump --linked --data-only -f data.sql

05③ Once a month, actually restore it

Reel frame: GitLab's postmortem, Data loss impact, the lost-data line boxed, a red all-failed stamp
GitLab's 2017 postmortem: several backup methods failed when needed, and about 6 hours of data were lost.

A backup alone isn't enough. On 31 Jan 2017 a GitLab engineer wiped what they thought was the secondary database, but it was the primary. The official postmortem says "the process of both finding and using backups failed completely", and data created between 17:20 and 23:30 UTC that day was lost, about 6 hours. They had backups; nobody had checked that they worked.

Reel frame: discs fly from the BACKUP crate onto the TEST pedestal, a restore-succeeded stamp
Illustration: once a month, restore a backup into a test environment and check it works.
  1. Set up a test database or project; never practise on production.
  2. Restore the latest backup into it (or import the files you exported with db dump).
  3. Open your most important tables and check the row counts and the newest records.
  4. Write down how long it took and where you got stuck, as a one-page restore guide.
  5. Put it on your calendar once a month.

06Good to know

  1. Supabase plans and retention were checked on 30 Oct 2026; the official page wins if they change.
  2. Restoring a Supabase project makes it unavailable while the restore runs, so practise on a test project.
  3. The Replit details come from Fortune's reporting, not from Replit's own documentation.
  4. "Once a month" is my suggested rhythm; the more often your data changes, the more often you should drill.

Sources

Related guides