# DB Guard

URL: https://agentvera.dev/en/features/db-guard/ · Plan: Free

When an agent writes a migration, the real question isn’t whether it runs but what it does to the production table. DB Guard scans changed migration files in the folder when an agent ends its turn, rates the risks and, if you want, tries the migration on a shadow database inside a transaction that is rolled back.

**What it catches.** Changed files under paths like migrations/, prisma/migrations, db/migrate and Flyway V1__x.sql are checked. It reads SQL for Postgres, MySQL and SQLite, and migration code for Rails, Laravel, Django and Knex- or Sequelize-style tools.

- DROP TABLE and DROP COLUMN, TRUNCATE, UPDATE and DELETE without WHERE.
- CREATE INDEX without CONCURRENTLY, ALTER TYPE, SET NOT NULL, new FK, CHECK and UNIQUE constraints.
- Migrations with no down step; RunPython without reverse_code in Django.
- Risk levels: none, low, medium, high; data loss is flagged separately.

**Real table sizes.** Pick one of your database manager connections as “production-like” and real row counts are read, so the risk scales with table size. Without one, risks are rated without knowing sizes. High or medium risk, or data loss, triggers a desktop notification.

**Try, review, fix.** Every report has buttons for the next step.

- Try on shadow DB: runs the migration on a development or staging connection inside a transaction that is always rolled back.
- Review with Claude: a read-only Claude review.
- Have the agent make it safe: the findings go to the agent that wrote the migration; if it is gone, a new “DB Guard fix” Claude agent opens.
- Analyse SQL: paste a Prisma migration.sql, artisan migrate --pretend or manage.py sqlmigrate output to check it.

**How to set it up:**

1. Open the DB Guard tab on a project’s Details page; automatic review is on by default.
2. In its settings, pick a production-like connection for table sizes and a shadow connection for trial runs.
3. When an agent writes a migration, read the report, and try it on the shadow DB or have an agent fix it.

- **Does it run anything on my production database?** Only table sizes are read from the production-like connection. Trial runs happen on the shadow connection, inside a transaction that is rolled back.
- **Which databases are supported?** SQL analysis covers Postgres, MySQL and SQLite; Rails, Laravel, Django and Knex-style migration code is read too.
- **Does it work without a connection?** Yes. Scanning works without one; risks are then rated without table sizes and trial runs aren’t available.

---

**About AgentVera.** AgentVera is a desktop app for macOS, Windows and Linux, built by Solviera Teknoloji. It runs 18 AI coding agents (Claude Code, Codex, Gemini CLI, Copilot, Cursor, Antigravity, opencode, Hermes, Qwen Code, Kimi Code, Kiro, Amp, Droid, Goose, Vibe, Crush, Aider, Cline) side by side, per project, in real terminals with the user's own CLI installs and logins. The free plan runs 2 agents at once. Download: https://agentvera.dev/en/download/ · Pricing: https://agentvera.dev/en/pricing/
