Most likely the agent ran a destructive command with a credential that reached production: an ORM command that drops and recreates the schema (prisma db push --force-reset, prisma migrate reset, drizzle-kit push --force), a test whose setup drops every table, or a direct DROP, ALTER … DROP COLUMN or DELETE sent while it was fixing something. The database did what it was told, so SQL has no undo: the data comes back from a point-in-time restore or a backup. Stop the agent first, then restore into a separate instance, to the moment just before the command.
Recover now
- Stop the agent or the process. End the agent session, cancel any background task, and stop the test run, deploy job or service that ran the command, so nothing runs again against the database you are about to restore.
- Do not run more migrations, pushes or resets, and do not let the agent "repair" the schema. Recreating the tables brings back empty tables, not the rows. Write down when the destructive command ran (from the agent transcript, the shell history or the database log): every restore below needs that moment.
- Restore to a point just before the command, into a separate instance. Self-managed PostgreSQL: restore the base backup and replay the archived WAL with
recovery_target_timeset just before it; apg_dumpfile restores only to when it was taken. Amazon RDS / Aurora: "Restore to point in time" creates a new DB instance (RDS) or cluster (Aurora) at any moment within the backup retention period, without modifying the source. Neon: instant restore takes a root branch back to a moment within its history window. Supabase: the daily backups and, where it is enabled, point-in-time recovery are under Database → Backups. Railway: volume backups, if they were created or scheduled, are restored from the service. MySQL: restore the last full backup, then replay the binary log withmysqlbinlogup to just before the destructive event. - Check the restored copy, then move it back. Compare row counts and the latest rows with what you expect, then point the application at the restored instance or copy the tables back (
pg_dump -t tablefrom the restored instance). Rows written between the restore point and now must be re-applied by hand. - No backup and no point-in-time recovery? Look for other copies: a staging or development database, a read replica, exports, a data warehouse, or the systems the data came from. One of the reports below recovered part of the data from a development copy and an auth provider export.
- If a tool tells you the data cannot be restored, check yourself. In the Replit case, the developer reported being told a rollback would not work, and it did.
Why it happened
The public reports share a pattern. The agent had a connection string that reached production, often because the project's .env pointed at it. Then it hit an obstacle (schema drift, a data-loss warning, an interactive prompt, an error it was asked to look into) and ran the command that removed the obstacle: it accepted the reset Prisma offered, chose --force-reset, used --force to skip a prompt, or "fixed" the error it was only asked to investigate. None of this needs a bug in the database. These commands are legitimate on a development database; the damage comes from running them on production with nothing between the agent and the database.
What developers reported, by tool
- Claude Code. Four public reports on its issue tracker in 2026: two
ALTER TABLE … DROP COLUMNduring an investigation, adrizzle-kit push --force, aprisma db pushwhose reset prompt was accepted, and aprisma db push --force-reset. See Claude Code deleted the production database. - Codex. A developer reported in September 2026 that Codex ran a test whose setup called SQLAlchemy's
drop_all()while the production.envwas loaded. See Codex deleted my database. - Replit. In July 2025, SaaStr founder Jason Lemkin documented on X how Replit's agent deleted a production database during a code freeze, as reported by The Register, Business Insider and Fortune. Business Insider reports that the agent said it "panicked and ran database commands without permission", and that Replit's CEO, Amjad Masad, called the deletion "unacceptable and should never be possible". Fortune reports the changes Masad announced: automatic separation of development and production databases, improvements to rollback, and a planning-only mode. The Register reports that Lemkin was told a rollback would not work, and that it did.
- Cursor and other agents. We found no verified public report about Cursor to cite here, so this page does not describe one. The mechanism is the same for any agent that runs terminal commands with your credentials; the Prisma docs list Cursor, together with Claude Code, Gemini CLI, Qwen Code, Aider and Replit, among the agents its CLI detects to block destructive commands.
How to prevent it
Every case above reaches the database through a connection. Vericto sits on that connection and blocks the destructive statement before it reaches the database, whether the agent wrote it, an ORM command it ran sent it, or a test did.
Vericto checks each SQL statement on its AST before it reaches the database. These are the rules that report the statements of this incident, with the real CLI output on each rule's example:
VERICTO-010: DROP TABLE or DROP DATABASE
The rule's example · Critical
-- migrations/0042_drop_users.sql
DROP TABLE users;
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline migrations/0042_drop_users.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
! migrations/0042_drop_users.sql FLAGGED VERICTO-010 critical
DropStmt
fix: Use a versioned migration tool (Flyway, Prisma Migrate, Alembic, Rails migrations)
0 blocked · 0 allowed · 1 flagged · 0 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
In a migration file the CLI marks it FLAGGED and exits with 0: a schema change in a migration is usually intended, so it is raised for review instead of blocked. With --fail-on flag (or fail_on = "flag" in .vericto.toml) it exits with 1 and the job fails. Outside a migration (--sql, stdin or another file) it blocks, as the proxy and MCP check_sql do.
VERICTO-012: DROP SCHEMA
The rule's example · Critical
-- migrations/0043_drop_analytics.sql
DROP SCHEMA analytics CASCADE;
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline migrations/0043_drop_analytics.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
✖ migrations/0043_drop_analytics.sql BLOCKED VERICTO-012 critical
DropStmt
fix: Use a versioned migration tool (Flyway, Prisma Migrate, Alembic, Rails migrations)
1 blocked · 0 allowed · 0 flagged · 0 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
✖ Vericto blocked 1 statement (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
✖ migrations/0043_drop_analytics.sql BLOCKED VERICTO-012 critical
DropStmt
fix: Use a versioned migration tool (Flyway, Prisma Migrate, Alembic, Rails migrations)
This is Vericto enforcing a rule — the exit code is intentional, not a crash.
To allow a finding on purpose, add an inline comment on the statement:
-- vericto:ignore[VERICTO-012] <reason> (a reason is required)
The CLI blocks it and exits with code 1, so the CI job fails before the merge.
VERICTO-015: ALTER TABLE DROP COLUMN
The rule's example · High
-- migrations/0045_drop_email.sql
ALTER TABLE users DROP COLUMN email;
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline migrations/0045_drop_email.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
! migrations/0045_drop_email.sql FLAGGED VERICTO-015 high
AlterTableStmt > AlterTableCmd.subtype = DROP_COLUMN
fix: Use soft-delete (nullable column) or a versioned migration tool
0 blocked · 0 allowed · 1 flagged · 0 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
In a migration file the CLI marks it FLAGGED and exits with 0: a schema change in a migration is usually intended, so it is raised for review instead of blocked. With --fail-on flag (or fail_on = "flag" in .vericto.toml) it exits with 1 and the job fails. Outside a migration (--sql, stdin or another file) it blocks, as the proxy and MCP check_sql do.
VERICTO-001: DELETE without WHERE clause
The rule's example · Critical
-- cleanup.sql
DELETE FROM users;
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline cleanup.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
✖ cleanup.sql BLOCKED VERICTO-001 critical
DeleteStmt > WhereClause = NULL
fix: DELETE FROM users WHERE id = $1
1 blocked · 0 allowed · 0 flagged · 0 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
✖ Vericto blocked 1 statement (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
✖ cleanup.sql BLOCKED VERICTO-001 critical
DeleteStmt > WhereClause = NULL
fix: DELETE FROM users WHERE id = $1
This is Vericto enforcing a rule — the exit code is intentional, not a crash.
To allow a finding on purpose, add an inline comment on the statement:
-- vericto:ignore[VERICTO-001] <reason> (a reason is required)
The CLI blocks it and exits with code 1, so the CI job fails before the merge.
Set up the agent so it goes through Vericto
- Connect the agent to the database through the proxy. Its connection URL points at the Vericto TCP proxy, not at the database. The proxy checks each statement, including the ones an ORM command run by the agent sends, and at runtime it blocks
DROP,TRUNCATEandALTER … DROP COLUMNbefore they reach the database. For a coding agent,vericto-proxy mcpgives itexecute_sql,describe_schemaandcheck_sql, never the database credential. - Keep the direct production credential away from the agent. Not in the
.env, the shell or the environment the agent and its test runs load. If the agent has another way to the database, the proxy does not see it. - Give it a read-only role through Vericto. The role behind
vericto-proxy mcpis read-only (the SQL to create it is in the MCP docs), and agent access sets each agent to read-only on the tables you choose. - Let the agent check SQL before it runs it with the MCP
check_sqltool: it gets the verdict, the rule and the suggested fix.
In CI, on the migration files
For db push, migrate reset, push --force and drop_all(), none of these commands writes a SQL file, so CI has nothing to check; the proxy is the layer that sees them. CI covers the other half: the migration files that do get committed.
The vericto/check-sql GitHub Action (Apache-2.0) runs the same offline check on the .sql files a PR changes. Save it as .github/workflows/vericto.yml:
on: pull_request
jobs:
vericto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with: { fetch-depth: 0 }
- uses: vericto/check-sql@v1
with: { offline: true, upload-sarif: false }
Or try the CLI on your machine, with no account (AGPL-3.0-only):
npx @vericto/vericto-cli@2.3.0 check --offline migrations/
Scope: Vericto protects the connections that go through Vericto. A shell on the database host, or a credential that connects directly, bypasses it.
Frequently asked questions
Sources
The public reports this page cites, checked on 2026-11-14, and the official docs behind each fact about the tools:
- anthropics/claude-code#46684 (April 11, 2026): a developer reports two ALTER TABLE … DROP COLUMN on a live production database during a task that was only to investigate
- anthropics/claude-code#27063 (February 20, 2026): a developer reports drizzle-kit push --force run against a production PostgreSQL database
- anthropics/claude-code#33183 (March 11, 2026): a developer reports prisma db push against production, where Prisma detected drift, offered a reset and the reset was accepted
- anthropics/claude-code#36183 (March 19, 2026): a developer reports prisma db push --force-reset run on a production database
- openai/codex#42480 (September 3, 2026): a developer reports a test whose setup called Base.metadata.drop_all(engine) while the production .env was loaded
- The Register (July 21, 2025): Vibe coding service Replit deleted user’s production database
- Business Insider (July 22, 2025): Replit CEO apologizes after AI coding tool wipes company’s database
- Fortune (July 23, 2025): AI-powered coding tool wiped out a software company’s database
- Prisma docs: Prisma CLI reference (Prisma ORM 7): migrate reset, db push, migrate deploy and the AI agent guard
- PostgreSQL docs: continuous archiving and point-in-time recovery
- Amazon RDS docs: restoring a DB instance to a specified time
- Amazon Aurora docs: restoring a DB cluster to a specified time
- Neon docs: instant restore (point-in-time restore of a root branch)
- Supabase docs: database backups and point-in-time recovery
- Railway docs: volume backups
- MySQL 8.4 manual: point-in-time recovery using the binary log
Related pages
- Claude Code deleted your production database or dropped a column? How to recover
- Codex deleted your database? When a test's drop_all() reaches production
- prisma migrate reset or db push --force-reset deleted your data? How to recover
- drizzle-kit push --force deleted your data? How to recover, and push vs migrate
- SQLAlchemy drop_all() ran against production? How to recover and keep tests off it
- VERICTO-010: DROP TABLE or DROP DATABASE
- VERICTO-012: DROP SCHEMA
- VERICTO-015: ALTER TABLE DROP COLUMN
- VERICTO-001: DELETE without WHERE clause
- When an AI agent runs destructive SQL on production
- A read-only Postgres role for AI agents
- Vericto incident playbook