# db schema (/docs/cli/db-schema) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Inspect a live database schema. Location: CLI > 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. ## Usage [#usage] #### bun ```bash bunx prisma db schema --db "$DATABASE_URL" ``` #### pnpm ```bash pnpm prisma db schema --db "$DATABASE_URL" ``` #### yarn ```bash yarn prisma db schema --db "$DATABASE_URL" ``` #### npm ```bash npx prisma db schema --db "$DATABASE_URL" ``` ## Options [#options] | Option | What it does | | ----------------- | ------------------------------------------------------ | | `--db ` | Connects to the database. | | `--config ` | Read this config file instead of `./prisma.config.ts`. | | `--json` | Prints machine-readable schema output. | ## Examples [#examples] #### bun ```bash bunx prisma db schema --db "$DATABASE_URL" bunx prisma db schema --db "$DATABASE_URL" --json > schema.json ``` #### pnpm ```bash pnpm prisma db schema --db "$DATABASE_URL" pnpm prisma db schema --db "$DATABASE_URL" --json > schema.json ``` #### yarn ```bash yarn prisma db schema --db "$DATABASE_URL" yarn prisma db schema --db "$DATABASE_URL" --json > schema.json ``` #### npm ```bash npx prisma db schema --db "$DATABASE_URL" npx prisma db schema --db "$DATABASE_URL" --json > schema.json ``` ## Data lines [#data-lines] `db schema` prints the tree on standard error and nothing on standard output, because the tree's shape depends on the database family. Use `--json` to read the schema in a script. [Global flags](https://www.prisma.io/docs/cli/global-flags#data-lines-of-prisma-orm-commands) lists the data lines of the other commands. ## Column types [#column-types] On PostgreSQL and SQLite, the tree and the JSON output show each column's type as the database names it. In the JSON output, this text is the column's `typeText`: ```bash npx prisma db schema --db "$DATABASE_URL" --json | jq 'select(.kind == "result") | .envelope.result.schema.tables[].columns[].typeText' ``` On PostgreSQL, `typeText` is the full type name, such as `integer` or `character varying(20)`, not a short name such as `int4`. An enum is named as your contract names it, such as `My Mood`, or `app.status` for an enum outside the `public` schema. A type from a schema that is not on the search path keeps the schema name, such as `extensions.vector(3)` for a pgvector column. On SQLite, which Prisma ORM 8 supports as an [experimental package](https://www.prisma.io/docs/orm/supported-databases), `typeText` is the type the column was declared with, in lower case: a column declared `VARCHAR(255)` reads `varchar(255)`. If a script reads `nativeType` or `resolvedNativeType` from the JSON output, change it to read `typeText`, which has replaced both fields since `8.0.0-rc.19`. ## Related commands [#related-commands] Use [`contract infer`](https://www.prisma.io/docs/cli/contract-infer) when you want to turn a live schema into a starter PSL contract. Use [`db verify`](https://www.prisma.io/docs/cli/db-verify) when you want to compare the live schema with the emitted contract. ## Related pages - [`auth`](https://www.prisma.io/docs/cli/auth): Sign in to your Prisma account from the CLI, sign out, and manage workspace sessions. - [`branch`](https://www.prisma.io/docs/cli/branch): List platform branches for a project. - [`bucket`](https://www.prisma.io/docs/cli/bucket): Create and manage object-store buckets. - [`Configuration`](https://www.prisma.io/docs/cli/configuration): Configure Prisma ORM CLI commands with prisma.config.ts and global flags. - [`contract emit`](https://www.prisma.io/docs/cli/contract-emit): Emit Prisma ORM contract artifacts.