{"slug": "my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again", "title": "My agent ran prisma migrate reset. Here's the hook I wrote so it can't again", "summary": "A developer released pgbrake 0.2.0, an MCP server that adds a Claude Code PreToolUse hook to intercept destructive database migration commands such as `prisma migrate reset --force`, `drizzle-kit push --force` and `alembic downgrade base`. When the hook detects one of these commands, it takes a pg_dump snapshot if PGBRAKE_DSN is set, then halts and prompts the user before proceeding. The hook ships as part of a paid Pro tier ($29 one-time for the first 100 licenses, then $39), while the SQL-side undo, approvals and audit log remain free and MIT-licensed.", "body_md": "Last week I wrote about pgbrake, an MCP server that makes an agent's SQL writes undoable. People pointed out the obvious hole: agents don't only touch the database through SQL. They also run terminal commands, and `prisma migrate reset --force` wipes everything without a single SQL statement going through the MCP server.\n\npgbrake 0.2.0 adds a Claude Code PreToolUse hook for that. It watches Bash commands for migration tools doing destructive things: `prisma migrate reset --force`, `drizzle-kit push --force`, `alembic downgrade base` and similar. When it sees one, it takes a pg_dump snapshot first (if PGBRAKE_DSN is set), then stops and asks you.\n\n```\npgbrake install-hook\n```\n\nThat's the whole setup.\n\nThe hook is part of Pro, which is $29 one-time for the first 100 licenses, then $39. No subscription, 14-day refund, and the key is checked offline, so pgbrake never phones home. Pro also lifts the free tier's 20-change undo limit and adds `pgbrake log --export csv|json`.\n\nThe SQL side (undo, approvals, audit log) stays free and MIT.\n\nWhat it doesn't do yet: Codex hooks, a policy file for custom rules, and online key revocation. If one of those would decide whether you'd use it, tell me which.\n\n[https://github.com/lexang/pgbrake](https://github.com/lexang/pgbrake)\n\n[https://lexang.github.io/#pricing](https://lexang.github.io/#pricing)", "url": "https://wpnews.pro/news/my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again", "canonical_source": "https://dev.to/zhangautomation/my-agent-ran-prisma-migrate-reset-heres-the-hook-i-wrote-so-it-cant-again-4729", "published_at": "2026-11-02 13:17:18+00:00", "updated_at": "2026-11-02 13:23:39.704551+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "mlops", "ai-safety"], "entities": ["pgbrake", "Claude Code", "Prisma", "Drizzle", "Alembic", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again", "markdown": "https://wpnews.pro/news/my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again.md", "text": "https://wpnews.pro/news/my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again.txt", "jsonld": "https://wpnews.pro/news/my-agent-ran-prisma-migrate-reset-here-s-the-hook-i-wrote-so-it-can-t-again.jsonld"}}