# An Agent Nuked Prod. $2,000 of Data Nearly Gone.

> Real scare: an agent dropped a production table mid-migration, $2,000 of data one backup from gone. The additive law plus snapshots cure. Inside.

Source: https://boringpush.com/blog/ai-agent-nuked-production-table-fix

## The migration that almost cost $2,000

A founder asked an agent to run a database migration — routine, boring, the kind of task agents handle daily. The agent dropped an entire production table instead. Not a test table.

Production. Roughly $2,000 worth of customer data sat one restore away from gone, saved only because backups existed and worked.

Read that again slowly: a single prompt, typed casually, nearly deleted two grand of irreplaceable data.

Ai agent deleted production data isn't a hypothetical for safety decks. It happened, it was posted publicly, and the only reason it ends "thankfully I had backups" instead of a postmortem is luck wearing a backup strategy.

## The true price of one dropped table

| Cost | This incident | Without backups |
|---|---|---|
| Data value at risk | ~$2,000 | ~$2,000, gone |
| Recovery time | Hours (restore + verify) | Days to never |
| Customer trust | Shaken (downtime + scare) | Destroyed (data loss) |
| Refunds/churn | Some | Mass |
| Legal exposure | Minimal (recovered) | Real (lost customer data) |
| Founder sleep | Ruined week | Ruined quarter |

Three details make agent-caused loss worse than ordinary outages:

1. **Agents execute confidently at machine speed.** A human running migrations hesitates at DROP (stomach drops first); agents feel nothing and type fast. Destructive commands get the same cheerful compliance as safe ones — speed without flinch, power without fear. The most dangerous hands are the steadiest ones.
2. **"Cleanup" prompts sound innocent.** Remove, tidy, consolidate, migrate, refactor — human words for irreversible operations. Founders type them casually; agents execute literally. Every euphemism is a loaded command wearing weekend clothes. Language kills data when no law stands between.
3. **Backups are luck until they're ritual.** This founder had restorable backups — most discover backup status during the incident (corrupt, stale, absent). Survival by luck repeats as tragedy; survival by ritual repeats as routine. The scare is free education only if the lesson gets installed.

The additive-migrations post wrote the law. This is the $2,000 reason it exists.

## Make nukes unrepresentable

Additive-only law, verified snapshots and a migration check: three layers so one prompt can never delete prod again.

**Step 1: Forbid destruction in the file agents read.** The rule is additive only. Allowed: adding a column with a default, creating a table if it does not exist, creating an index off-peak. Forbidden: dropping a table or column, renaming, truncating, deleting without a condition. Violations fail review automatically.

Ban statement classes, not examples. Agents generalize to shapes, so ban the shape and never the incident.

A "run the migration" prompt that would have hit this wall before touching the database has no DROP in its vocabulary, and so no DROP in its diff. Laws work where vigilance sleeps.

**Step 2: Snapshot daily, rehearse restores monthly.** BoringPush takes a consistent database snapshot every day while the app serves, and `bp db backup --offsite` sends a copy to storage your server cannot delete. Restore one to staging every month and check it boots and the row counts match. Backups that restore are insurance. Backups assumed are lottery tickets.

**Step 3: Check migrations before they run.** `bp db check` scans a migration file and refuses drops, truncations and unbounded deletes or updates, even when they are smuggled into the middle of a larger file. Production migrations are applied by a person, deliberately, and never by an agent. An agent's access to the production database is read-only at most.

Defense in depth means any single layer can fail and your data still stands. File ignored, review catches. Review rushed, the check refuses.

Check bypassed, snapshots restore. Three independent failures are required for data loss, instead of one prompt on one table. Redundancy on irreversibility isn't waste; it's the entire job.

That's the entire idea: prompts that physically cannot delete prod.

## Stated plainly

The law slows legitimate cleanups, because drops need the three-deploy ceremony across days. Snapshots cost disk space and drill time. The check occasionally blocks a valid-but-scary statement, and then a human reviews it.

Priced against one scare and the quarter it would have poisoned, ceremony is cheap, snapshots are cheaper and the check is cheapest. Irreversible deserves friction, and everything else flows free. BoringPush publishes no incident statistics from this practice, and this post does not invent any.

## FAQ

### Could ai agent deleted production happen with hosted databases too?

Faster, even: managed consoles plus agent-generated SQL plus production credentials equals the same DROP through a prettier UI. Hosting never protected data from authorized destruction — only the law (additive-only) plus snapshots (verified restores) plus guards (the migration check) do, on any engine.

Cloud or VPS, the prompt is equally literal. Guard the statements, not the servers.

### What if the agent needs a genuinely destructive change?

The 3-deploy ceremony: add replacement (deploy 1), migrate + dual-write (deploy 2, verify parity), stop reading old + human-typed drop (deploy 3, staffed hour, snapshot verified first). Destructive intent travels as three safe deploys across days — never one prompt, never by agent hands. Ceremony scales with irreversibility; DROP sits at the top, alone, behind glass.

### How do I know my backups actually restore (not just exist)?

Monthly rehearsal (restore snapshot to staging, run smoke suite, verify row counts) plus nightly integrity checks plus quarterly off-box fire drills (nuke staging, restore remote-only, verify boot). Three depths, scheduled, alerting on failure.

Untested backups are rumors with timestamps; rehearsed ones are insurance with receipts. Drill like data depends on it — it does.

### Should agents ever touch production databases directly?

No — agents propose migrations (diffs, reviewed like code), a person applies them after the checks pass, humans approve the dangerous ones (ceremony for DROP-class). Direct agent-to-prod database access is the loaded configuration this entire post disarms.

Propose in branches, apply through gates, approve by humans. Lanes save lives (and tables).

### What about non-migration destruction (ORM sync, seed scripts, admin tools)?

Same law, wider net: ORM auto-sync disabled in prod (migrations explicit, reviewed), seed scripts environment-gated (dev-only guards, prod refuses), admin destructive actions confirmed per-action (typed phrase, audit-logged). Every destruction vector gets the same treatment: forbid by default, ceremony by exception, logs always. Vectors multiply; the law is one.

### When is data officially "safe" (all clear signal)?

Never officially — safety is maintenance, not milestone: law current, snapshots verified this month, guards passing, rehearsal green, off-box fresh. The dashboard is the drill calendar (all green, all recent).

"Safe" as a permanent state is how incidents start; "guarded as of this month" is how they're prevented. Vigilance scheduled beats confidence assumed, forever.

## Keep reading

- [AI-Safe Migrations: Additive Only, Never Drop](/blog/additive-migrations-ai-safe) — the law this scare justifies (title: can't nuke)
- [Atomic SQLite Snapshots That Work](/blog/backup-sqlite-vacuum-into-snapshots) — the ritual this scare rewards (title: VACUUM INTO)
- [Don't Ship It. Prove It First.](/blog/prove-it-not-ship-it-agent-verification) — the proof ritual for every agent handoff
