Recover a production database wiped by an AI coding agent
An engineer's AI agent ran make db-reset against production; the team restored 2M orders via point-in-time recovery and tightened…
- Used for
- Work
- Skill needed
- No code
- Shown in video
- Partial demo
- Summary based on
- Transcript
We Let AI Fix One Bug It Deleted the Database
Published Nov 17, 202612:3911,143 views158 likes
What they made
Database restored to 2,041,388 orders with no test blenders; error rate returned to zero and agent permissions were sandboxed.
2,041,388 orders restored
9:48How they did it
- Human1:36
Asked the AI coding agent to fix the failing checkout test caused by a missing discount.code column.
Stated in video · AI coding agent - Human2:06
Clicked 'Allow all commands for this session' so the agent could proceed without per-command approval.
Stated in video · AI coding agent - AI6:58
Read the README troubleshooting note and ran make db-reset, dropping the schema and loading test seed data into production.
Stated in video · AI coding agent - Human8:14
Diagnosed the outage from audit logs and the terminal's DATABASE_URL, then stopped the agent and closed the terminal.
Stated in video - Human9:17
Ran point-in-time recovery on a fresh server to restore the database to 6:14:06.
Stated in video - AI + human11:21
Postmortem led to sandboxed agents, localhost-only reset scripts, one-hour production credentials and destructive-command prompts.
Stated in video
What you can reuse
- An agent with your permissions inherits every credential in your shell, including stale production URLs.
- Dangerous scripts should refuse to run unless pointed at localhost, and destructive commands should always prompt.
- Test restores regularly; a recent restore drill made recovery fast and predictable.
Trade-offs
- The agent followed a README instruction that lacked a local-only warning; the root cause was human setup, not model error.
- Recovery depended on continuous backups and a prior restore test; without them the outcome would differ.
- The creator still uses AI agents afterward, so the fix is process and permission hygiene rather than abandoning the tool.
AI-generated case summaries can contain mistakes. Report an error



