Prototype a schema
Rapidly iterating on a schema during early development.
Prisma · Command
prisma db push synchronizes the Prisma schema directly to a database without migrations. It is intended mainly for prototyping and local development, and in Prisma v7 client generation must be run separately when needed.
Prisma compares the Prisma schema with the database and applies the required changes directly, creating the database when it is absent. It does not create or update migration files, so use it for prototyping or development when schema history is unnecessary; in Prisma v7, run generators explicitly afterward if needed.
prisma db push [options]| Name | Type | Description |
|---|---|---|
options | CLI options | Optional flags such as --schema, --config, --url, --accept-data-loss, and --force-reset. |
Updates the target database to reflect the Prisma schema; the command does not return an application value.
--url.--accept-data-loss.prisma generate yourself when the schema change requires regenerated Prisma Client code.npx prisma db push --schema=./prisma/schema.prisma
npx prisma generatePushes the Prisma schema to the configured database, then explicitly regenerates Prisma Client when needed.
Rapidly iterating on a schema during early development.
Applying an initial schema when migration history is not yet needed.
Testing a potentially destructive schema change after reviewing its impact.
prisma db push do?It synchronizes the database directly from the Prisma schema without using migrations. It can also create the database if it does not already exist.
Follow-up: How would you handle a change that may destroy data? Pass --accept-data-loss only when the consequences are understood; otherwise revise the schema or use a safer migration workflow.
db push instead of migrations?It is suited to prototyping and local development when schema changes do not need versioned migration history. It applies the current schema state directly rather than generating migration files.
Follow-up: What should replace it when reproducible schema history matters? Use Prisma Migrate and commit the generated migration files.
In Prisma v7, the command no longer invokes generators automatically. After pushing a schema change, run prisma generate explicitly if generated artifacts such as Prisma Client must reflect the new schema.
Follow-up: Why can an application fail after a successful push? The database may be updated while generated client code still represents the previous schema.
prisma generateprisma migrate devprisma db executePrisma config file