Comprehensive audit of the custom migration runner, all 26 migrations,
query patterns, foreign keys, and schema state management.
Critical findings:
- F-B1-11 P0: Server starts with incomplete schema after migration
failure, prints [OK] — main.go swallows migration errors
- F-B1-1: Migration 024 self-inserts into schema_migrations
- F-B1-2: Migration 024 references non-existent deprecated column
- F-B1-3: Migration 018 scanner_config has wrong file extension
- F-B1-6: N+1 query in GetDashboardStats (1 query per agent)
15 findings total across P0/CRITICAL/HIGH/MEDIUM/LOW.
See docs/B1_Database_Audit.md for full analysis.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>