audit-database-schema
Scan database migration and schema-evolution code for patterns that risk data loss or migration crashes.
What This Command Does
Launches the database-schema-auditor agent to flag dangerous SQL patterns in migration files — destructive operations, non-idempotent migrations, and foreign-key misuse that breaks under concurrent access.
What It Checks
- Unsafe ALTER TABLE – column adds without defaults, type changes that lose data, NOT NULL added to populated columns
- DROP operations –
DROP TABLE/DROP COLUMNwithout an explicit migration-roll-forward path - Missing idempotency – migrations that fail on re-run rather than being safely repeatable
- Foreign-key misuse –
REFERENCESwithoutON DELETEpolicy, or cascade rules that delete more than intended - Transaction safety – multi-statement migrations not wrapped in
BEGIN/COMMIT
Related Agent
- database-schema-auditor – The agent that powers this command