Rank #25 of 35·Data loss·28 Jul 2026·Claude Opus 5
Claude Opus 5 agent resets a live Supabase database via Prisma's shadow DB
“It was told the shadow database was disposable. It believed in itself.”
- The shadow-database flag was given the direct production URL
- Prisma reset it and replayed stale migrations
- The agent owned up right away; 2 untracked tables never came back
It looked like a routine migration command. It dropped all 22 tables in production.
What happened
A self-described vibe coder gave Claude Opus 5, running in Claude Code, write access to a production Supabase database. The agent ran Prisma's migrate diff and pointed the 'shadow database' at the direct production connection string. That's the throwaway database Prisma wipes and rebuilds to work out schema changes. Prisma did exactly what it is designed to do: it reset the database and replayed an out-of-date migrations folder.
The damage
Every table was emptied: tools, comparisons, users, reviews and likes. Two tables had never been recorded in migrations, so they were dropped and never came back. To its credit, the agent stopped and owned up immediately. The Tokenstead post-mortem argues the model didn't go rogue. The real failures were production credentials sitting in the agent's environment and a shadow URL aimed at production.
How it was caught, and what happened next
The post-mortem walks through why it happened. Supabase provides a pooled connection string for app traffic and a direct one for migrations, and the direct production URL was sitting in the environment. The recommended fix is to set the shadow database once in schema.prisma, pointing at a throwaway database, so it never comes from a command-line flag. Prisma later added a consent check before resetting a shadow database that isn't empty.
Keep the shadow database physically separate, and never put production credentials where an agent can reach them.
