Claude Code ran supabase db reset to fix a migration error

5 min read

Claude Code ran supabase db reset to fix a failed migration. HOL Guard paused it before your local data was wiped: Allow just this once or Keep blocked.

Claude Code ran supabase db reset to fix a migration error
On this page

You were in Claude Code. A migration failed, and Claude Code picked the fastest fix it could find: supabase db reset. The reason it gave was "Reset the local Supabase database to fix the migration error." Nobody asked you first.

If that runs, your local Supabase database gets rebuilt from scratch. Supabase recreates the local Postgres container, replays every file in supabase/migrations, then loads supabase/seed.sql. Anything that isn't in those files is gone: the test users you signed up by hand, the rows you spent an afternoon shaping to reproduce a bug. A table you changed in Studio without writing a migration goes too.

HOL Guard paused the reset before it started. Two buttons came up on screen: Allow just this once, or Keep blocked. Until you click Allow, the database hasn't been touched.

HOL Guard Inbox: PAUSED ACTION Needs review on supabase db reset from Claude Code, Allow just this once and Keep blocked
Local Inbox review when Claude Code queued supabase db reset. Card is Needs review with Allow just this once and Keep blocked.
Close-up of Allow just this once (green) and Keep blocked buttons on HOL Guard review card
Button labels on the live review card: Allow just this once, Keep blocked. Allow covers this one action only.

Keep blocked leaves the database as it is. The receipt stays on your machine.

What does supabase db reset delete?

Plain supabase db reset wipes the local development database and rebuilds it from your migration files and seed file. The Supabase CLI reference says any other data or schema changes made during local development are discarded. It needs the local stack running (supabase start), and it does not touch your hosted project.

The flags change the target:

  • --linked or --db-url points the reset at a remote database. Supabase runs a SQL script that drops every user-created entity in it. Custom Postgres roles survive, because roles live at the cluster level.
  • --no-seed skips seed.sql, so the tables come back holding only what your migrations insert.
  • --version and --last reset up to a given migration instead of the latest one.

The captured command here was plain supabase db reset, so the loss is local: dev data that only existed in that container. A local database often holds the only copy of the state you need to reproduce a bug.

Why the chat confirmation isn't enough

Claude Code wrote its own reason for the reset and sent the shell command. A migration error is exactly the moment an agent reaches for "start clean," because a reset makes the error go away. Whether your data matters doesn't enter into it.

A confirmation in the chat only works if the agent decides to ask. Guard sits on the tool call itself. The pause happens because the command matched a rule, not because the agent felt cautious. Claude Code can't click Allow for you, and if it tries to approve its own request from the shell, that's a separate Guard Extension (command.guard-self-protection).

What Guard maps

Built-in Supabase command protection (command.database.supabase, v1.0.0, critical). Catalog default: review. One operation: Supabase database reset (command.database.supabase.reset). Permission ID: command.database.supabase.permission.reset.

Catalog example: supabase db reset.

In the live capture, Claude Code sent supabase db reset through the Bash tool. Guard's verdict was review under rule command.database.supabase.reset, and the request sat in the Inbox until someone answered it.

A workspace can tighten this to block. Catalog default isn't your fleet policy. On Protect / Extensions, leave posture at Protected unless you have a reason to Watch. Watch will not stop the reset.

How do I test it without losing data?

Install HOL Guard from the install page, then run:

hol-guard init

Keep command.database.supabase at Protected, then check the rule without touching a database. command test and command explain don't run the command, create an approval, or write a receipt. You don't need the Supabase CLI installed or a project open.

hol-guard command test 'supabase db reset'
hol-guard command explain 'supabase db reset'
hol-guard command controls show command.database.supabase

Both supabase db reset and supabase db reset --linked come back as review under command.database.supabase.reset. Run the test again after you upgrade Guard. If it says unrecognized, check that the Extension is current and posture isn't Watch.

Before you allow a reset, take a copy of the local data. supabase db dump --local --data-only -f local-data.sql writes the rows to a file, and Guard doesn't pause it.

Out of scope

command.database.supabase covers the reset operation above. It doesn't cover:

  • Raw SQL an agent sends through psql, such as DROP TABLE. In our test, psql -c "DROP TABLE users" didn't match this Extension.
  • supabase projects delete and supabase storage rm. Neither matched in our test.
  • rm -rf supabase/migrations, which belongs to command.filesystem.
  • docker volume rm on the database volume, which belongs to command.container-runtime.
  • An agent approving its own pending request: command.guard-self-protection.

After the Inbox lights up

Look at the command on the card before you decide. Plain supabase db reset is local. --linked or --db-url is a remote database, and that one deserves a second look at which project is linked.

If you want the reset and the local data is disposable or dumped, choose Allow just this once. If not, Keep blocked and ask Claude Code to fix the failing migration instead: read the error, edit the migration file, rerun it. The receipt stays local. Cloud sync is optional and doesn't carry the raw command.

What do people ask about supabase db reset?

Does supabase db reset delete production data?

Not by default. Plain supabase db reset only resets the local development database started by supabase start. With --linked or --db-url, it targets a remote database and drops all user-created entities there, so an agent adding that flag is the case to watch.

What do I lose when an AI agent runs supabase db reset?

Every row and schema change in your local database that isn't in supabase/migrations or supabase/seed.sql. Supabase rebuilds the database from those files and discards everything else.

How do I stop Claude Code from resetting my Supabase database?

Install HOL Guard and keep the Supabase command protection Extension (command.database.supabase) at Protected. When Claude Code sends supabase db reset, Guard pauses it in the Inbox until you choose Allow just this once or Keep blocked.

Does this work for Cursor or other coding agents?

The pause in this post was captured from Claude Code. The rule matches the command text whichever agent sent it, so hol-guard command test 'supabase db reset' shows you the verdict without any agent involved.

Background: HOL Guard 3.0.

All articles

Keep exploring

The engineering desk continues across the ecosystem: security research on shipping agents safely, and plugins that put the standards to work.