Verify parity

prisma-sql-verify runs the same read queries through plain Prisma and through the speed extension on the same database, then diffs the results — including value types (DateTime, BigInt,Decimal) and nested include shapes. Use it before adopting and after upgrades.

Usage

npx prisma-sql-verify \
  --corpus queries.jsonl \
  --generated ./generated/sql \
  --client @prisma/client \
  --sqlite ./data.db

# or PostgreSQL
npx prisma-sql-verify \
  --corpus queries.jsonl \
  --generated ./generated/sql \
  --client ./dist/prisma/generated/client/index.js \
  --postgres-url $DATABASE_URL

Corpus format

One JSON object per line. Only supported read methods are allowed.

{"model":"user","method":"findMany","args":{"take":5}}
{"model":"user","method":"findFirst","args":{"include":{"posts":true},"orderBy":{"id":"asc"}}}
{"model":"user","method":"count","args":{"where":{"status":"ACTIVE"}}}
{"model":"user","method":"aggregate","args":{"_count":true,"_avg":{"age":true}}}

Flags

FlagDescription
--corpusPath to the JSONL corpus file (required)
--generatedGenerated SQL module or directory exporting speedExtension (required). Under tsx, a directory with index.ts works too.
--clientModule path or package name exporting PrismaClient (required)
--sqliteSQLite database file to verify against
--postgres-urlPostgreSQL connection string (falls back to DATABASE_URL)
--client-initJSON string passed to the PrismaClient constructor. When omitted, prisma-sql-verify auto-builds a driver adapter for Prisma 7 clients (@prisma/adapter-better-sqlite3 / @prisma/adapter-pg must be installed).
--verbosePrint passing queries too

Exit codes and output

  • 0 — every query matches Prisma
  • 1 — at least one mismatch; each mismatch prints the diff paths, e.g.$.assignedTasks[0].dueDate: prisma=... extended=..., ready to paste into an issue
  • 2 — usage or setup error
Tip: build your corpus from real application queries. A corpus of realistic shapes is worth more than a large synthetic one.