# db verify (/docs/cli/db-verify) > 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. Verify a database against the current Prisma ORM contract. Location: CLI > db verify `db verify` checks whether the database marker and live schema match your emitted contract. It verifies the marker first, then checks the schema. Use it in CI and deployment checks before application code that depends on a contract reaches users. ## Usage [#usage] #### bun ```bash bunx prisma db verify --db "$DATABASE_URL" ``` #### pnpm ```bash pnpm prisma db verify --db "$DATABASE_URL" ``` #### yarn ```bash yarn prisma db verify --db "$DATABASE_URL" ``` #### npm ```bash npx prisma db verify --db "$DATABASE_URL" ``` ## Options [#options] | Option | What it does | | ----------------- | --------------------------------------------------------------------------- | | `--db ` | Connects to the database. | | `--marker-only` | Checks only the database marker. | | `--schema-only` | Checks only whether the live schema satisfies the contract. | | `--strict` | Fails if the database includes schema elements not present in the contract. | | `--config ` | Read this config file instead of `./prisma.config.ts`. | | `--json` | Prints machine-readable output. | ## Exit codes [#exit-codes] | Code | Meaning | | ---- | ---------------------------------------------------------------------------------------------- | | `0` | The database matches the contract. | | `2` | The check could not run: conflicting mode flags, no emitted contract, or unreachable database. | | `4` | Drift or a marker finding. | ## Examples [#examples] #### bun ```bash bunx prisma db verify --db "$DATABASE_URL" bunx prisma db verify --db "$DATABASE_URL" --strict bunx prisma db verify --db "$DATABASE_URL" --schema-only bunx prisma db verify --db "$DATABASE_URL" --marker-only ``` #### pnpm ```bash pnpm prisma db verify --db "$DATABASE_URL" pnpm prisma db verify --db "$DATABASE_URL" --strict pnpm prisma db verify --db "$DATABASE_URL" --schema-only pnpm prisma db verify --db "$DATABASE_URL" --marker-only ``` #### yarn ```bash yarn prisma db verify --db "$DATABASE_URL" yarn prisma db verify --db "$DATABASE_URL" --strict yarn prisma db verify --db "$DATABASE_URL" --schema-only yarn prisma db verify --db "$DATABASE_URL" --marker-only ``` #### npm ```bash npx prisma db verify --db "$DATABASE_URL" npx prisma db verify --db "$DATABASE_URL" --strict npx prisma db verify --db "$DATABASE_URL" --schema-only npx prisma db verify --db "$DATABASE_URL" --marker-only ``` Use JSON output in automation: #### bun ```bash bunx prisma db verify --db "$DATABASE_URL" --json ``` #### pnpm ```bash pnpm prisma db verify --db "$DATABASE_URL" --json ``` #### yarn ```bash yarn prisma db verify --db "$DATABASE_URL" --json ``` #### npm ```bash npx prisma db verify --db "$DATABASE_URL" --json ``` `db verify` prints nothing on standard output, even when piped. Its exit code is the result of the verification, and `--json` carries the findings. [Global flags](https://www.prisma.io/docs/cli/global-flags#data-lines-of-prisma-orm-commands) lists the data lines of the other commands. ## What failures mean [#what-failures-mean] | Failure | Meaning | | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Marker mismatch | The database was not signed for the emitted contract, or the contract changed after signing. | | Schema mismatch | The live database does not satisfy the emitted contract. | | Strict mismatch | The database has extra schema elements not present in the contract. With `--strict`, tables that no contract declares are reported as `CONTRACT.SCHEMA_VERIFICATION_FAILED`, and the result's `unclaimed` list names them. Before `8.0.0-rc.15` they were reported as `CONTRACT.MARKER_REQUIRED`, which now only means the database has not been signed. | | Extension mismatch | The contract requires an extension that is not wired in the config. | Fix the database or contract, emit again if needed, then verify again. ### Schema differences in JSON output [#schema-differences-in-json-output] When the live schema does not match the contract, the `--json` output has a diagnostic with the code `CONTRACT.SCHEMA_VERIFICATION_FAILED`. Its `meta.space` names the contract space. Its `meta.schemaIssues` lists each difference as an object with these keys: * `path`: where the difference is, as a list of names, such as `["public", "users", "email"]`. * `expected`: what the contract has. A missing object has only `expected`. * `actual`: what the database has. An extra object has only `actual`, and a mismatch has both. * `explanation`: an optional object with a `text`. The diagnostic's `why` lists the same differences as text. `db init`, `db update` and `db migrate` report `MIGRATION.SCHEMA_VERIFY_FAILED` with the same `meta.schemaIssues`. Before `8.0.0-rc.20`, the key was `meta.issues`, a list of strings such as `"missing: public/users/email"`, so update any script that reads it. ## How column types are compared [#how-column-types-are-compared] `db verify` treats two ways of writing the same column type as equal. So `Numeric(10)` in your contract matches a `numeric(10,0)` column, and `VarChar(20)` matches `character varying(20)`. The migration planner compares types the same way, so neither command reports a difference that is only in how a type is written. When a database column has a type that Prisma ORM has no type for, either for your database or in the extensions listed in `prisma.config.ts`, the message says so: ```text The database column is "point", which no data type in the configured stack declares. ``` "The configured stack" in the message means your database and those extensions. Add the extension that provides the type to your config, or declare the column in your contract with ``Raw(sql`point`)``. ## How PostgreSQL defaults are compared [#how-postgresql-defaults-are-compared] When a column default is a literal value, `db verify` reads it as a value before it compares it with your contract, so the casts PostgreSQL adds when it prints the default do not cause a difference. This covers numbers such as `'-1'::integer` and `(5)::smallint`, text and enum values, including an enum value cast to a type in another PostgreSQL schema, `timestamp` values, `true`, `false`, `NULL`, JSON, and lists written as `'{...}'` or `ARRAY[...]`. `db verify` also recognizes `now()`, `clock_timestamp()`, `gen_random_uuid()`, and a sequence default, which it treats as `autoincrement()`. Any other default is a SQL expression, which you write in your contract as a `sql` default, such as ``@default(sql`(now() + '00:03:00'::interval)`)``. [Default values](https://www.prisma.io/docs/orm/contract-authoring/psl-syntax#default-values) shows how to write one. `db verify` cannot work out whether two SQL expressions give the same value, so it compares their text, ignoring letter case and spaces. PostgreSQL often rewrites an expression when it stores it, for example by adding casts, so write a `sql` default in your contract the way PostgreSQL stores it. To see that form, run `npx prisma contract infer --output ./inferred.prisma` and copy the column's `@default` from that file. When a `sql` default fails the check because PostgreSQL stores it in another form, the message shows both texts and the `sql` literal to write: ```text The database reads this default back as sql`(now() - '1 day'::interval)`; the contract declares sql`now() - interval '1 day'`. The database may store a default expression in its own form, so the two can mean the same. If they do, write the default as sql`(now() - '1 day'::interval)`. ``` Check constraints and the `WHERE` clause of a partial index are compared more strictly than `sql` defaults: their text must match exactly, including letter case and spaces. If `db verify` reports a difference in a `timestamptz` value inside a check constraint or a partial index's `WHERE` clause, check whether your contract was inferred before `8.0.0-rc.12` from a server that was not set to UTC. `db verify` reads the database with the time zone set to UTC and dates in ISO format, whatever the server or your database role sets, so a value that your contract has in another time zone no longer matches as text. To fix it, copy the new text from a fresh `npx prisma contract infer --output ./inferred.prisma` into your contract, emit the contract, and run `db sign`. ## 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.