Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Command

prisma db push

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.

How it works

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.

Syntax

prisma db push [options]

Parameters

NameTypeDescription
optionsCLI optionsOptional flags such as --schema, --config, --url, --accept-data-loss, and --force-reset.

Returns

Updates the target database to reflect the Prisma schema; the command does not return an application value.

Key points

  • It applies the schema's current state directly to the database rather than creating a migration.
  • An absent target database is initialized as part of the operation.
  • Use it for rapid prototyping or local development where migration history is not required.
  • Database connection details come from the Prisma configuration, unless overridden with --url.
  • The command accepts optional flags for configuration paths, data-loss handling, and reset behavior.
  • The reset option clears the database before applying the Prisma schema.

Common mistakes

  • Potentially destructive changes are rejected unless you explicitly pass --accept-data-loss.
  • Run prisma generate yourself when the schema change requires regenerated Prisma Client code.
  • This command does not preserve migration history or produce migration files.

Example: Push a schema and regenerate the client

npx prisma db push --schema=./prisma/schema.prisma
npx prisma generate

Pushes the Prisma schema to the configured database, then explicitly regenerates Prisma Client when needed.

When to use it

Prototype a schema

Rapidly iterating on a schema during early development.

Initialize a development database

Applying an initial schema when migration history is not yet needed.

Explicitly allow data loss

Testing a potentially destructive schema change after reviewing its impact.

Interview questions

QWhat does 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.

QWhen should you use 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.

QWhat changed about generation in Prisma v7?

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 generate
  • prisma migrate dev
  • prisma db execute
  • Prisma config file

Source: Options. Checked 2026-10-16.