Back to Vibe Coder Toolkit
Codebase
Schema Drift
Prisma vs reality
npx promptreports-cli schemaParses prisma/schema.prisma, validates schema, checks migration status. Counts models, fields, relations.
schema is the Prisma whisperer. It parses your schema.prisma to count every model, field, relation, index, and enum. Runs `prisma validate` to catch syntax errors. With --drift, runs `prisma migrate status` to detect when your DB schema is out of sync with your Prisma schema — a common source of silent prod bugs.
On this page
Prerequisites
- prisma/schema.prisma
- Prisma CLI available via npx
Flags & Options
| Flag | Description | Default |
|---|---|---|
| --stats | Stats (default) | — |
| --drift | Check DB drift | — |
| --pending | List pending migrations | — |
| --verify | Run `prisma validate` | — |
| --json | JSON output | — |
Examples
Stats
npx promptreports-cli schemaCount everything.
Drift check
npx promptreports-cli schema --driftIs your DB behind?
Full pre-deploy
npx promptreports-cli schema --verify --drift --pendingEverything before `migrate deploy`.
Output
Box with schema counts + validation status + recent migrations + drift warning (if any).
┌─ Prisma Schema Stats ───────────────────┐
│ Models: 42 │
│ Fields: 287 │
│ Relations: 58 │
│ Indexes: 23 │
│ Enums: 8 │
│ │
│ Validation: ✓ Valid │
│ Migrations: 49 applied, 0 pending │
└──────────────────────────────────────────┘
Recent migrations:
- 20260418180000_add_newsletter_tables (applied 2 hours ago)
- 20260417120000_research_pipeline (applied yesterday)
- 20260415000001_swarm_activity_stages (applied 3 days ago)
⚠ DRIFT DETECTED on production:
Migration 20260417180000_research_pipeline
Status: Applied in code, NOT applied in DB
Fix: npx prisma db execute --file prisma/migrations/.../migration.sqlWhat it reads and writes
Reads
- prisma/schema.prisma
- prisma/migrations/
Writes
Nothing (read-only)
API calls
- npx prisma validate, npx prisma migrate status (15s timeout each)
Free vs Pro usage
Free tier
- Pre-deploy sanity check
- Onboarding new devs (how big is the DB?)
- Catch the exact issue you hit today (marked applied but not run)
Pro tier
Upgrade- Drift detection on cron — alert before users notice
- Migration approval workflow (PR required for destructive changes)
- Schema diff between branches visualized
- Cross-environment drift (staging vs prod)
Pro tips
- Always run --drift before prisma migrate deploy
- Pending migrations in Git but not in DB = real pain; this catches it
- Validate in CI — saves 3am debugging