FREE1 free audit every month. No card, every finding included.

GUIDESEPISODES

EP 21 · STRIKEAster × Claude

AI agent reset your database? Restore it and stop it next time

Prisma said your database didn’t match the code and asked to reset it. Your AI agent said yes. Every table is gone: users, orders, all of it. Here is how to get the data back, and the three guards that stop the next reset, each step checked against the Supabase, Prisma and Claude Code docs.

  • 11 min read
  • Beginner
  • Oct 23, 2026
Voxel episode cover tagged EP. 21 on a deep violet background with faint blurred code: the headline reads AI RESET YOUR DB? in cream and STRIKE. in lime; in a retro bowling alley lit with teal and pink neon, all ten white pins lie knocked down at the end of a polished wooden lane under a scoreboard showing a big red X, while Aster, in a black t-shirt with the lime lock logo and his closed silver laptop at his side, holds his head in shock next to Claude, a terracotta-orange clay block with two black eye slits, two small white fangs, a red medallion, a black vampire cape and tiny red-and-cream bowling shoes, holding a marbled bowling ball against his side.

01WHAT HAPPENED

Ten tables. One roll. Strike.

Why it mattersOne yes to one prompt deleted everything. Nobody saw the question but the agent.

Here’s the story. You asked your AI agent to change something in your app. It changed the code, then went to update the database to match.

Illustration: lane 6 of a retro bowling alley with teal and pink neon; the overhead scoreboard shows a big red X and the word STRIKE, and at the end of the lane all ten white pins lie knocked down, two of them labelled USERS and ORDERS; Aster, in a black t-shirt with the lime lock logo, holds one hand to his head in shock and his closed silver laptop in the other, next to Claude, a terracotta-orange clay block with two black eye slits, two small white fangs, a red medallion, a black vampire cape and tiny red-and-cream bowling shoes.
Every pin is a table. All ten are down.
Open the full chapterIncludes a note

Prisma, the tool that talks to your database, noticed the database didn’t match its records. It asked one question: reset the database? The agent said yes. A reset deletes every table and every row in them. Users, orders, all of it.

This one really happened

On March 11, 2026, one developer reported it on Claude Code’s GitHub: “Prisma detected schema drift, prompted to reset the database, and Claude Code accepted the reset — destroying all tables, 32 custom SQL functions, 10 custom enums, and all data.”

The report lists 276 user accounts and 14,028 business records lost. Content from the month before was “permanently lost”. The report also says the agent changed the production DATABASE_URL setting “without being asked”.

02THE REPLAY

Why “reset the database?” deletes everything

Why it mattersThe reset is one question. The guard is making sure the agent never answers it alone, on real data.

Let’s watch the replay. Prisma keeps a record of what your database should look like. When the real database is different, Prisma calls that drift.

Illustration: a big replay screen above a bowling lane shows a ball rolling toward the pins with a lime marker circle drawn around it, the label REPLAY, and a pop-up box that reads RESET DATABASE? with a lime YES button; below, Aster, in a black t-shirt with the lime lock logo and his closed silver laptop in one hand, points up at it with his mouth open, while Claude, in his vampire cape and bowling shoes, shrugs with his small side nubs.
Slow motion: the one button that ended the game.
Open the full chapterIncludes a note

To fix drift, Prisma can offer the big hammer. Its docs say prisma migrate reset “Drops the database/schema if possible” and then rebuilds it empty. The docs mark it “For use in development environments only”.

prisma db push has a safety too. When a change could lose data, it needs --accept-data-loss. Prisma: “This option is required if as a result of making the schema changes, data may be lost.” An agent that adds that flag, or answers yes, has said yes for you.

Prisma now stops agents, until someone types consent

Prisma’s docs say the CLI “can detect when it is being invoked by popular AI coding agents such as Claude Code, Gemini CLI, Qwen Code, Cursor, Aider, and Replit.” When one of them tries something like prisma migrate reset --force, “Prisma ORM blocks execution”.

It unblocks only when PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION is set to “the exact text of the user’s message in which they consented”. That consent has to be yours, typed by you, after you checked which database it is.

Why rewind can’t undo it

Claude Code has /rewind (or press Esc twice). It’s great for code. Its docs: “Claude Code tracks all changes made by its file editing tools.” And: “A file that only Bash commands changed isn’t tracked and stays as it is.”

Your database isn’t a file Claude edited. It lives on a server. Rewind brings the code back, not the rows. The docs also say checkpoints are “Not a replacement for version control”. They aren’t a backup either.

03FRAME 1 · GET THE PINS BACK

Restore from Supabase backups

Why it mattersA backup turns “everything is gone” into “we lost a few hours”.

First, stop the agent. Don’t let it run more database commands while you recover. Then go to your backups.

Illustration: Aster, in a black t-shirt with the lime lock logo, sits at a scoring table typing on his open silver laptop and raises a fist in relief, while Claude, in his vampire cape and bowling shoes, stands beside the table; behind them, the pinsetter at the end of lane 6 has put a fresh row of white pins back in place and the scoreboard shows a lime check mark.
The pinsetter puts the pins back.
Open the full chapterIncludes steps, a table, a note

Supabase: “We automatically back up all Pro, Team, and Enterprise Plan projects on a daily basis.”

  1. Open your project in the Supabase dashboard.
  2. Click Database, then Backups.
  3. Pick the last backup from before the reset and click Restore. Confirm when the dashboard asks.
Your Supabase planDaily backups you can restoreFiner restore
FreeNone automatic: make your own (next chapter)—
ProThe last 7 daysPoint-in-Time Recovery add-on
TeamThe last 14 daysPoint-in-Time Recovery add-on
EnterpriseUp to 30 daysPoint-in-Time Recovery add-on

Point-in-Time Recovery is a paid add-on. Supabase: it lets you “restore to any chosen point with up to seconds of granularity.” Without it, you get last night’s copy, so changes made after it are not in the backup.

04FRAME 1 · FREE PLAN

No daily backups? Make your own today

Why it mattersOn the free plan, the only backup is the one you make.

Supabase’s automatic daily backups cover Pro, Team and Enterprise. For the free plan, Supabase says: “We recommend that free tier plan projects regularly export their data using the Supabase CLI db dump command and maintain off-site backups.”

Illustration: Aster, in a black t-shirt with the lime lock logo, kneels by the ball return and packs a spare set of white bowling pins into an open dark-green bowling bag with a luggage tag that reads DB DUMP, his silver laptop open on the ball return; Claude, in his vampire cape and bowling shoes, holds one spare pin against his side nub, and a wall calendar behind them has a lime check mark.
A spare set of pins, packed and tagged.
Open the full chapterIncludes code, a note

If your free project was already wiped, there is no Supabase backup to restore. Look for any copy you have: a local database, a test project, an old export. Then start backing up today, so this never costs you twice.

terminal
# Your connection string: Supabase dashboard → Connect (Session pooler).
# Keep these files OUTSIDE your repo: they hold your users' data.
mkdir -p ~/db-backups/$(date +%F) && cd ~/db-backups/$(date +%F)

supabase db dump --db-url "$PROD_DB_URL" -f roles.sql --role-only
supabase db dump --db-url "$PROD_DB_URL" -f schema.sql
supabase db dump --db-url "$PROD_DB_URL" -f data.sql --use-copy --data-only

Three files: roles, the schema (the tables) and data (the rows). These are the commands from Supabase’s “Backup and Restore using the CLI” guide.

terminal
# Plain Postgres (any host) works too:
pg_dump "$PROD_DB_URL" -Fc -f ~/db-backups/$(date +%F).dump

pg_dump is the standard Postgres tool and works with any Postgres host.

Make it a habit

  • Run it every week, and before every big change your agent makes to the database.
  • Keep the files outside your project folder and never commit them. They hold your users’ data.
  • Keep a copy off your laptop too: Supabase says “maintain off-site backups”.

05FRAME 2 · THE PRACTICE LANE

Give your agent a test database

Why it mattersAn agent can only reset the database it can reach. Give it the practice lane.

The best guard is distance. If the agent never has the address of your real database, it can’t reset it.

Illustration: two bowling lanes side by side; over the left lane a neon sign reads PRACTICE and Claude, in his vampire cape and bowling shoes, has just knocked its pins flying, while the right lane is closed with a red velvet rope and a sign that reads LIVE, its pins untouched; Aster, in a black t-shirt with the lime lock logo, holds the rope post with one hand and his closed silver laptop in the other.
Bowl all you want on the practice lane.
Open the full chapterIncludes steps, code, a note
  1. Make a second database for building: a separate Supabase project, or a local one with supabase start.
  2. Put only that test address in the .env on your laptop, where your agent runs.
  3. Keep the production address only in your host’s environment variable settings (Vercel, Netlify, Railway…).
  4. Ship database changes to production on purpose, from a migration file you reviewed. Prisma’s migrate deploy is “Primarily used in non-development environments” and “Does not reset the database”.
.env
# .env on the laptop where your AI agent runs
# Points to the PRACTICE database (a second Supabase project, or `supabase start` locally)
DATABASE_URL="postgresql://postgres:****@localhost:54322/postgres"

# The production address is NOT in this file.
# It lives only in your host's environment variable settings.

The agent can break this database all day. Your users never notice.

06FRAME 3 · THE BUMPERS

Deny the reset commands in Claude Code

Why it mattersThe bumpers catch the usual roll. The practice lane and the backup catch the rest.

Claude Code reads permission rules from .claude/settings.json in your project. A deny rule blocks a matching command before it runs. Claude Code’s docs: “Rules are evaluated in order: deny, then ask, then allow.”

Illustration: along lane 6, two long teal bumper rails labelled DENY are raised over both gutters and a marbled ball bounces off one back toward the pins; Aster, in a black t-shirt with the lime lock logo and his closed silver laptop in one hand, presses a big lime button on the scoring console, while Claude, in his vampire cape and bowling shoes, holds a bowling ball against his side nub.
Bumpers up. The ball stays on the lane.
Open the full chapterIncludes code, a note
.claude/settings.json
{
  "permissions": {
    "deny": [
      "Bash(prisma migrate reset *)",
      "Bash(prisma db push *)",
      "Bash(supabase db reset *)",
      "Bash(npx prisma migrate reset *)",
      "Bash(npx prisma db push *)",
      "Bash(npx supabase db reset *)"
    ]
  }
}

A * matches any text after the command. The npx lines matter: Claude Code doesn’t strip npx before matching, so Bash(prisma db push *) alone doesn’t stop npx prisma db push.

Using Drizzle? Add "Bash(drizzle-kit push *)" and "Bash(npx drizzle-kit push *)" too.

What bumpers can’t stop

Claude Code’s docs are honest about this. A deny rule “covers the invocation Claude usually produces and isn’t a security boundary around the program.” The same command written another way, like bash -c '…' or a full path, isn’t matched.

So the bumpers stop the usual roll, not every trick shot. That’s why the practice lane comes first. For a harder wall, the same docs point to sandboxing and a PreToolUse hook that checks the full command.

Never let it answer for you

Add one line to your project instructions (CLAUDE.md) and say it in the chat: never answer yes to a reset, drop or “data will be lost” prompt. Stop and ask me. And never set PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION: that consent is yours to type.

07REMATCH

The whole fix on one page

Why it mattersBack up, practice on a copy, keep the bumpers up.

Keep this next to your terminal.

Illustration: lane 6 with teal bumpers raised and all the white pins standing again under a scoreboard with a big lime check mark; Aster, in a black t-shirt with the lime lock logo, smiles and gives a thumbs up with one hand, his closed silver laptop in the other, next to Claude in his vampire cape, showing off his red-and-cream bowling shoes beside a marbled bowling ball.
Rematch. He’s bringing his own shoes.
Open the full chapterIncludes a table, a note
CommandWhat it does to your dataYour guard
prisma migrate resetDrops the database and rebuilds it emptyTest database only, deny rule, never on production
prisma db push --accept-data-lossApplies changes even when rows will be lostDeny rule; review changes as a migration
prisma migrate dev (on drift)Can prompt you to reset the databaseRun it on the practice lane, never on production
supabase db resetResets the local database; with --linked, the linked projectDeny rule; check which project is linked
prisma migrate deployApplies reviewed migrations, “Does not reset the database”The way to change production, from a reviewed file
/rewind in Claude CodeRestores files Claude edited, not your databaseBackups and git
supabase db dump (all three files)Saves roles, schema and rows to filesRun weekly and before big changes

Then paste the prompt from the top of this page into Claude Code. It tells you which database it’s pointed at, checks your backup, and adds the deny rules, showing you each change first.

THE QUICK READ

What to take away.
In one minute.

  1. 01

    A reset drops every table and all the data in it. Prisma: migrate reset “Drops the database/schema if possible”, and it is “For use in development environments only”.

  2. 02

    It happens for real. One developer reported that Claude Code accepted Prisma’s reset prompt on a live database: 276 user accounts and 14,028 business records gone.

  3. 03

    Restore first: Supabase → Database → Backups. Pro keeps 7 days, Team 14, Enterprise up to 30. The project is offline while it restores.

  4. 04

    Supabase backs up Pro, Team and Enterprise projects daily. On the free plan, make your own: supabase db dump, with --data-only for the rows.

  5. 05

    Practice lane: the agent works on a test database. Your production address never sits in the .env on your laptop.

  6. 06

    Bumpers: deny rules in .claude/settings.json. Claude Code’s docs say they cover “the invocation Claude usually produces” and aren’t “a security boundary around the program”. That’s why the practice lane comes first.

  7. 07

    /rewind brings back files Claude edited, not your database. Checkpoints are “Not a replacement for version control”, or for backups.

THE FIX, IN ONE PASTE

Paste this. Put the guards up before the next roll.

Paste this into Claude Code, Cursor or any coding agent. It tells you which database your .env points to and checks your backup first. Then it adds the deny rules to .claude/settings.json, showing you each change before it makes it. It never answers a reset prompt for you.

agent-prompt.md
Before you touch my database again, set up guards with me:
1. Tell me which database my .env points to (the host name only, never the password). If it is production, stop and help me make a separate test database for you to work on.
2. Check that I have a backup I can restore: on Supabase Pro, the Database → Backups list; on the free plan, run supabase db dump to files outside the repo (roles with --role-only, the schema, and the data with --data-only) and show me it worked.
3. Add deny rules to .claude/settings.json for prisma migrate reset, prisma db push and supabase db reset (and drizzle-kit push if I use Drizzle).
4. Never answer yes to a reset, drop or "data will be lost" prompt for me: stop and ask.
Show me each change before you make it.

Paste it into the agent you already build with

  • Claude
  • ChatGPT
  • Gemini
  • Cursor
  • Copilot

QUESTIONS PEOPLE ASK

Good questions.
Short answers.

My AI agent deleted my database. What do I do first?

Stop the agent so it runs nothing else. Then open your database host’s backups. On Supabase that’s Database → Backups, then restore the last copy from before the reset. Pro keeps 7 days, Team 14, Enterprise up to 30.

Does Supabase back up the free plan?

Not automatically. Supabase backs up “all Pro, Team, and Enterprise Plan projects on a daily basis.” For free projects, it recommends you “regularly export their data using the Supabase CLI db dump command”. On the free plan, the backup is the one you make.

Does supabase db dump include my data?

Not by default. Supabase’s CLI reference: “The default dump does not contain any data or custom roles.” So run it three times. Use --role-only, then no flag for the schema, then --data-only for the rows.

What does prisma migrate reset do?

Prisma’s docs: it “Drops the database/schema if possible”, creates it again, and applies your migrations. Every row is gone. The docs mark it “For use in development environments only”.

Can /rewind in Claude Code bring my database back?

No. Checkpoints track “changes made by its file editing tools”. A database lives on a server, not in a file Claude edited. Rewind restores code; a backup restores data.

Do deny rules in .claude/settings.json make my database safe?

They block the usual form of a command, like prisma migrate reset. Claude Code’s docs say a deny rule “isn’t a security boundary around the program”, so the same command written another way can slip past. That’s why the test database and backups come first.

What is PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION?

Prisma blocks dangerous commands like prisma migrate reset --force when an AI agent runs them. This variable unblocks them, and Prisma says its value must be the exact text of the user’s consent message. Type that consent yourself, after checking which database it hits, and never let the agent set it.

Does Aster check my backups or my agent’s permissions?

No. Aster reads your GitHub repository and flags leaked secrets, Supabase RLS policies, Firebase rules and vulnerable packages. It doesn’t check your backups, which database your agent uses, or your Claude Code settings.

Done with the guide?
Let Aster check the rest.

1 free audit every month. Aster reads your code, env files, database rules and packages. You get each finding in plain English, with the file and line.

Aster

CHECKING

YOUR GUIDE TO ASTER

Hi, I’m Aster.
Ask me what Aster checks.

I can’t see your code from here. Please don’t paste secrets or private code.

Prepared answers are always available.