Documentation Index
Fetch the complete documentation index at: https://mintlify.com/prisma/prisma-next/llms.txt
Use this file to discover all available pages before exploring further.
prisma-next db schema connects to a live database, queries its catalog, and renders the discovered schema as a human-readable tree or a machine-consumable JSON envelope. The command is entirely read-only — it never writes files, modifies schema, or touches the contract marker.
This is useful for spot-checking what a database actually contains, debugging schema drift, or confirming the result of a migration before signing. The output reflects native database types (for example int4, text, timestamptz) rather than mapped codec IDs, giving you an accurate view of the actual database state.
Options
Database connection string. Optional when
db.connection is set in your config file.Path to
prisma-next.config.ts. Defaults to ./prisma-next.config.ts in the current working directory.Output a JSON result envelope to stdout instead of the TTY tree.
Quiet mode. Suppresses all output except errors.
Verbose mode. Prints debug information and timing data.
Trace mode. Prints deep internals and full stack traces.
Force color output. Use
--no-color to disable color output entirely.Config requirements
db schema requires a driver entry in your config to open a database connection. A contract entry is not required since this command does not read or compare contract artifacts.
prisma-next.config.ts
Usage examples
Output formats
Column types in the output are native database types (
int4, text, timestamptz), not Prisma Next codec IDs (pg/int4@1). This reflects the actual database state and may differ from the codec mappings defined in your contract.Introspection process
The command follows these steps internally:- Connects to the database using
config.driver.create(url). - Builds a
ControlStackand creates a family instance viaconfig.family.create(stack). - Calls
familyInstance.introspect()to query the database catalog and return a family-specific schema IR (for example,SqlSchemaIRfor the SQL family). - Calls
familyInstance.toSchemaView()to project the schema IR into aCoreSchemaViewfor display. - Renders the
CoreSchemaViewas a tree (TTY) or JSON envelope (--json).
Error codes
| Code | Meaning |
|---|---|
PN-CLI-4005 | Missing database connection. Provide --db <url> or set db.connection in config. |
PN-CLI-4010 | Missing driver in config. Add a driver descriptor to your config. |