Audit & Verification
sate db
Static database-portability analysis: flags tests using MySQL-specific raw SQL, JSON operators, transaction locks, FK assumptions, or enums.
What it does
Scans every test file for patterns that won't behave identically across database engines. Categorises hits into raw SQL (high-risk: DB::raw, DB::statement, FOR UPDATE, JSON_EXTRACT, ALTER TABLE), transaction semantics (lockForUpdate, beginTransaction), JSON operators (whereJsonContains, raw ->>), FK assumptions (ForeignKeyConstraintViolationException), and enum reliance.
Who runs this
- →Teams considering a database migration (MySQL → PostgreSQL or in-memory SQLite for fast tests)
- →Pre-acquisition technical due-diligence
How to invoke
sate db --project-root /path/to/laravel-app --scan-allFlags
--project-root <path>Required.
--scan-allScan every *Test.php under tests/, not just paths declared in phpunit.xml.
--jsonEmit machine-readable JSON to stdout.
--listShow per-file lists alongside summary counts.
--limit <N>default: 200Cap list output rows.
What it produces
- ·Text summary by default
- ·--json: structured report with per-bucket file lists
- ·--list: per-file breakdown
What it does NOT do
- ✖Does NOT execute SQL or connect to a database
- ✖Does NOT auto-migrate or rewrite tests
- ✖Does NOT prevent intentional coupling — it just makes it visible
Notes
Handles both bare `DB::raw(` and FQN `\Illuminate\Support\Facades\DB::raw(` call styles (Bug DB2 fix).
Status
Engine tests
22
Status
Shipped
Category
Audit & Verification