db 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.
bunx prisma db schema --db "$DATABASE_URL"pnpm prisma db schema --db "$DATABASE_URL"yarn prisma db schema --db "$DATABASE_URL"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. |
bunx prisma db schema --db "$DATABASE_URL"
bunx prisma db schema --db "$DATABASE_URL" --json > schema.jsonpnpm prisma db schema --db "$DATABASE_URL"
pnpm prisma db schema --db "$DATABASE_URL" --json > schema.jsonyarn prisma db schema --db "$DATABASE_URL"
yarn prisma db schema --db "$DATABASE_URL" --json > schema.jsonnpx prisma db schema --db "$DATABASE_URL"
npx prisma db schema --db "$DATABASE_URL" --json > schema.jsonUse 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.