prisma-next db verify confirms that a database instance is aligned with the emitted contract.json. By default it runs two checks in sequence: it reads the contract marker stored in the database and compares its hashes against the contract, then introspects the live schema to confirm no manual DDL has drifted it away from the contract.
Both checks must pass for the command to exit with code 0. You can narrow the scope with --marker-only (skip schema check) or --schema-only (skip marker check), and you can tighten the schema check with --strict to reject schema elements that are present in the database but absent from the contract.
Options
string
Database connection string. Optional when
db.connection is set in your config file.string
Path to
prisma-next.config.ts. Defaults to ./prisma-next.config.ts in the current working directory.boolean
Check only the contract marker. Skip schema verification entirely. Cannot be combined with
--schema-only or --strict (exits with code 2, PN-CLI-4012).boolean
Check only the live database schema against the contract. Skip marker verification entirely. Can be combined with
--strict.boolean
When schema verification runs, treat schema elements not present in the contract as failures rather than warnings. Cannot be combined with
--marker-only.string
Output a JSON result envelope to stdout.
boolean
Quiet mode. Suppresses all output except errors.
boolean
Verbose mode. Prints debug information and timing data.
boolean
Trace mode. Prints deep internals and full stack traces.
boolean
Force color output. Use
--no-color to disable color output entirely.Config requirements
db verify requires a driver entry in your config to connect to the database.
prisma-next.config.ts
Verification process
1
Load contract
Reads
contract.json from the path specified by config.contract.output.2
Connect to database
Creates a driver instance using
config.driver.create(url).3
Create family instance
Builds a
ControlStack via createControlStack() and passes it to config.family.create(stack).4
Verify marker (default and --marker-only)
Calls
familyInstance.verify() which reads the contract marker from the database and checks:- Marker presence (
PN-RUN-3001if missing). - Target compatibility (
PN-RUN-3003if the contract target does not matchconfig.target). storageHashmatch (PN-RUN-3002if hashes differ).profileHashmatch (PN-RUN-3002if hashes differ, when present).- Codec coverage (reports missing codecs when contract column types are not covered).
--schema-only is provided.5
Verify schema (default and --schema-only)
Calls
familyInstance.schemaVerify() to introspect the live schema and compare it against the contract. In default (tolerant) mode, extra schema elements are allowed. With --strict, extra elements are treated as failures.Skipped when --marker-only is provided.Output formats
JSON output
Full success (--json)
Error codes
Choosing a verification mode
--marker-only accepts the trade-off that schema drift since the last signing will go undetected. Use it only when you control both the schema and the signing workflow, and you want to minimize verification overhead.Relationship to db sign
db verify reads the marker that db sign writes. If db verify reports PN-RUN-3001 (marker missing), run db sign to create the marker. If it reports PN-RUN-3002 (hash mismatch), re-sign the database after ensuring the schema matches the contract.