prisma-next contract infer
Infer a starter contract from an existing database.
prisma-next contract infer inspects a live database and writes a starter PSL contract.
Use it when you are adding Prisma Next to an existing database and want an initial contract to review and edit.
Usage
prisma-next contract infer --db "$DATABASE_URL"Options
| Option | What it does |
|---|---|
--db <url> | Connects to the database. |
--config <path> | Reads a specific prisma-next.config.ts file. |
--output <path> | Writes the inferred PSL contract to a specific path. |
--json | Prints a machine-readable result. |
Examples
prisma-next contract infer --db "$DATABASE_URL"
prisma-next contract infer --db "$DATABASE_URL" --output ./prisma/contract.prisma
prisma-next contract infer --db "$DATABASE_URL" --jsonWhat to review
Inference gives you a starting point, not a finished design. Review:
- model and field names
- relation names
- mapped database names
- defaults, indexes, and constraints
- extension-backed column types
Then run:
prisma-next contract emit
prisma-next db sign --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"db sign is the handoff point where you record that the existing database matches the reviewed contract.