Skip to main content
Back to Vibe Coder Toolkit
Codebase

Schema Drift

Prisma vs reality

npx promptreports-cli schema

Parses 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.

Prerequisites

  • prisma/schema.prisma
  • Prisma CLI available via npx

Flags & Options

FlagDescriptionDefault
--statsStats (default)
--driftCheck DB drift
--pendingList pending migrations
--verifyRun `prisma validate`
--jsonJSON output

Examples

Stats

npx promptreports-cli schema

Count everything.

Drift check

npx promptreports-cli schema --drift

Is your DB behind?

Full pre-deploy

npx promptreports-cli schema --verify --drift --pending

Everything 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.sql

What 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
Free to try

Install the whole toolkit.

One command unlocks all 23 tools.