Skip to main content
Prisma Documentation Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

db schema

Inspect a live database schema.

db schema reads the live database schema and prints it as a tree, or as the result document with --json. The command is always read-only: it never writes a file and never changes the database.

Use it when you need to inspect what Prisma ORM sees in the database before inferring, signing, updating, or debugging drift.

bun
bunx prisma db schema --db "$DATABASE_URL"
pnpm
pnpm prisma db schema --db "$DATABASE_URL"
yarn
yarn prisma db schema --db "$DATABASE_URL"
npm
npx prisma db schema --db "$DATABASE_URL"
Option What it does
--db <url> Connects to the database.
--config <path> Read this config file instead of ./prisma.config.ts.
--json Prints machine-readable schema output.
bun
bunx prisma db schema --db "$DATABASE_URL"
bunx prisma db schema --db "$DATABASE_URL" --json > schema.json
pnpm
pnpm prisma db schema --db "$DATABASE_URL"
pnpm prisma db schema --db "$DATABASE_URL" --json > schema.json
yarn
yarn prisma db schema --db "$DATABASE_URL"
yarn prisma db schema --db "$DATABASE_URL" --json > schema.json
npm
npx prisma db schema --db "$DATABASE_URL"
npx prisma db schema --db "$DATABASE_URL" --json > schema.json

Use contract infer when you want to turn a live schema into a starter PSL contract. Use db verify when you want to compare the live schema with the emitted contract.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu