database-schema-auditor
Scans database migration and schema code for the 10 most critical violations — unsafe ALTER TABLE patterns, DROP operations, missing idempotency, foreign key misuse, and transaction safety.
How to Use This Agent
Natural language (automatic triggering):
- "Can you check my database migrations for safety?"
- "Review my GRDB schema code for issues"
- "Audit my SQLite migrations before release"
- "Check my database code for data loss risks"
Explicit command:
bash
/axiom:audit database-schemaWhat It Does
- ADD COLUMN NOT NULL Without DEFAULT (CRITICAL) — Crashes for all users with existing data
- DROP TABLE on User Data (CRITICAL) — Permanent data deletion
- DROP COLUMN (CRITICAL) — Unsupported before SQLite 3.35.0 (iOS 16+)
- ALTER TABLE Without Idempotency (CRITICAL) — Crashes on re-run
- INSERT OR REPLACE Breaks Foreign Keys (HIGH) — Silently deletes child records
- Foreign Key Addition Without Validation (HIGH) — Fails with orphaned rows
- PRAGMA foreign_keys Not Enabled (HIGH) — Constraints silently ignored
- RENAME COLUMN Without Migration Strategy (MEDIUM) — Breaks raw SQL references
- Batch Insert Outside Transaction (MEDIUM) — 30x slower without wrapping
- CREATE Without IF NOT EXISTS (MEDIUM) — Breaks migration idempotency
Related
- database-migration — Safe schema evolution patterns for SQLite/GRDB/SwiftData
- grdb — GRDB patterns and DatabaseMigrator reference