mountsqli analyze
mountsqli analyze compares your code-defined schema against the live database
and reports actionable health information. Run it in CI or before a release.
Run it
Section titled “Run it”mountsqli analyzeWhat the report covers
Section titled “What the report covers”| Section | What it checks |
|---|---|
| Drift | code schema vs live DB (introspect diff) |
| Index suggestions | columns used in filters/joins without an index |
| Plan warnings | queries that scan full tables or miss constraints |
Example output
Section titled “Example output”$ mountsqli analyzeDrift: noneIndexes: suggest INDEX on "orders"("customerId")Plans: "users".where("email" = ?) — add UNIQUE on emailHow it works
Section titled “How it works”flowchart LR A[code TableDef[]] --> B[diffSchemas vs live] C[live DB via introspect] --> B B --> D[Drift report] E[QueryPlans] --> F[suggestIndexes] F --> G[Index suggestions]
Best practices
Section titled “Best practices”- Run
analyzein CI to fail on drift before deploy. - Apply suggested indexes after confirming query patterns.
- Re-run after schema changes to keep suggestions fresh.
Common mistakes
Section titled “Common mistakes”- Ignoring drift warnings — they mean code and DB disagree.
- Adding every suggested index blindly — measure first.
Related
Section titled “Related”- Migrations → Introspect — the drift source.
- Migrations → Status — applied vs pending.
