prisma-next db init
Initialize a database from the current Prisma Next contract.
prisma-next db init creates missing database structures from the current emitted contract and signs the database.
Use it for first setup of a database that should match your current contract.
Usage
prisma-next db init --db "$DATABASE_URL"Options
| Option | What it does |
|---|---|
--db <url> | Connects to the database. |
--config <path> | Reads a specific prisma-next.config.ts file. |
--dry-run | Shows planned operations without applying them. |
--json | Prints a machine-readable result. |
Behavior
db init is intended for bootstrap work. It creates missing structures needed by the contract and writes the contract marker after the database matches.
Run a dry run first when you are not working with a disposable local database:
prisma-next db init --db "$DATABASE_URL" --dry-runExamples
prisma-next contract emit
prisma-next db init --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"prisma-next db init --db "$DATABASE_URL" --dry-run --jsonWhen to use db update instead
Use prisma-next db update when the database already exists and you want Prisma Next to reconcile it with a changed contract. Use prisma-next migration plan when you want a reviewable migration package in version control.