They serve two different environments. The prisma db push is not to be used in your production environment, as stated in the docs

db push uses the same engine as Prisma Migrate to synchronize your Prisma schema with your database schema, and is best suited for schema prototyping. The db push command:

  1. Introspects the database to infer and executes the changes required to make your database schema reflect the state of your Prisma schema.

  2. By default, after changes have been applied to the database schema, generators are triggered (for example, Prisma Client). You do not need to manually invoke prisma generate.

  3. If db push anticipates that the changes could result in data loss, it will:

  • Throw an error
  • Require the --accept-data-loss option if you still want to make the changes

Note: db push does not interact with or rely on migrations. The migrations table will not be updated, and no migration files will be generated.

The prisma migrate dev is used in you local environment, as explained in the docs

migrate dev is a development command and should never be used in a production environment.

This command:

  1. Replays the existing migration history in the shadow database in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
  2. Applies pending migrations to the shadow database (for example, new migrations created by colleagues)
  3. Generates a new migration from any changes you made to the Prisma schema before running migrate dev
  4. Applies all unapplied migrations to the development database and updates the _prisma_migrations table
  5. Triggers the generation of artifacts (for example, the Prisma Client)

The migrate dev command will prompt you to reset the database in the following scenarios:

  • Migration history conflicts caused by modified or missing migrations
  • The database schema has drifted away from the end-state of the migration history

If you have any other question regarding this, there is this comparison in the docs explaining when to use one or the other.

Answer from Daniel Olavio Ferreira on Stack Overflow
🌐
Prisma
prisma.io › home › push › push › push
prisma db push | Apply Schema to Database (No Migrations) | Prisma Documentation
The prisma db push command pushes the state of your Prisma schema to the database without using migrations.
Get started with Prisma
Build, deploy, and iterate on TypeScript applications with Prisma ORM, Prisma Postgres, and Prisma Compute.
Prisma Postgres Plans and Usage-Based Pricing
Compare Prisma Postgres plans, usage-based pricing, included features, and workspace options. Start free and scale as your product grows.
Prisma getting started
Choose the fastest path to start using Prisma ORM, Prisma Postgres, or Prisma Compute in a new or existing TypeScript project.
Quickstart with TypeScript & SQLite
Create a new TypeScript project from scratch by connecting Prisma ORM to Prisma Postgres and generating a Prisma Client for database access.
Top answer
1 of 4
19

They serve two different environments. The prisma db push is not to be used in your production environment, as stated in the docs

db push uses the same engine as Prisma Migrate to synchronize your Prisma schema with your database schema, and is best suited for schema prototyping. The db push command:

  1. Introspects the database to infer and executes the changes required to make your database schema reflect the state of your Prisma schema.

  2. By default, after changes have been applied to the database schema, generators are triggered (for example, Prisma Client). You do not need to manually invoke prisma generate.

  3. If db push anticipates that the changes could result in data loss, it will:

  • Throw an error
  • Require the --accept-data-loss option if you still want to make the changes

Note: db push does not interact with or rely on migrations. The migrations table will not be updated, and no migration files will be generated.

The prisma migrate dev is used in you local environment, as explained in the docs

migrate dev is a development command and should never be used in a production environment.

This command:

  1. Replays the existing migration history in the shadow database in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
  2. Applies pending migrations to the shadow database (for example, new migrations created by colleagues)
  3. Generates a new migration from any changes you made to the Prisma schema before running migrate dev
  4. Applies all unapplied migrations to the development database and updates the _prisma_migrations table
  5. Triggers the generation of artifacts (for example, the Prisma Client)

The migrate dev command will prompt you to reset the database in the following scenarios:

  • Migration history conflicts caused by modified or missing migrations
  • The database schema has drifted away from the end-state of the migration history

If you have any other question regarding this, there is this comparison in the docs explaining when to use one or the other.

2 of 4
11
  • Prisma db push syncs (and formats) your prisma schema to that of your database schema.
  • While prisma migrate dev "command automatically generates SQL migration files (saved in /prisma/migrations) and applies them to the database".

The main difference between both is the generation of the migration files.

Discussions

I ran `prisma db push`, and now when I run `prisma migrate dev` it prompts me to reset the database. How do I migrate without resetting and losing the data?
I ran `prisma db push`, and now when I run `prisma migrate dev` it prompts me to reset the database. How do I migrate without resetting and losing the data? More on github.com
🌐 github.com
4
1
November 9, 2022
need to run db push twice in order to apply changes
Bug description It happened many times to me already that I run db push, it says “:warning: We found changes that cannot be executed:” and “The PostgreSQL database “db” from “localhost:5340" w... More on github.com
🌐 github.com
2
June 2, 2021
Switch to migrations after db push
Hello , I got a new project from a client , and they are using SQLite , I noticed they do not have any migrations , but rather db push directly , as this is not safe , I want to switch them to migrations , however how can we manage that without losing data as firing the migration will issue a drift More on answeroverflow.com
🌐 answeroverflow.com
February 22, 2025
npx prisma db push -> dangerous
(EDIT: First of all, I love this repo. Nice work! 🎉 ) Problem Is your feature request related to a problem? Please describe. pnpm migrate is a wonderful first step, and prisma db push is just fine ... More on github.com
🌐 github.com
1
January 2, 2025
🌐
Prisma
prisma.io › home › prototyping your schema › prototyping your schema › prototyping your schema › prototyping your schema
Prototyping your schema | Prisma Documentation
The db push command: Introspects the database to infer and executes the changes required to make your database schema reflect the state of your Prisma schema.
🌐
Prisma
prisma.io › home › prisma cli reference › prisma cli reference › prisma cli reference
Prisma CLI reference | Prisma Documentation
Applies all unapplied migrations to the development database and updates the _prisma_migrations table · This command is not supported on MongoDB. Use db push instead.
Top answer
1 of 1
6

Hello @lumenwrites

npx prisma db push is meant for development use only. The development db is considered "resettable" and "seedable" as its used to develop your migrations and to test/tweak them if needed. Looks like you have used it in your production environment. In production, you should use npx prisma migrate deploy and it would ensure your db won't get reset in any case.

Now in order to resolve your current situation we need to tweak the migrations history using some primitives which migrate provides like the diff command(https://www.prisma.io/docs/reference/api-reference/command-reference#migrate-diff)

  1. You will need to generate a new migration which will be the difference between migrations history stored in your disk in the migrations folder and your production database. The --to-schema-datasource flag here point to the database stored in your .env file but you can also change this flag to --to-url if you prefer to give the database url in the command itself.
mkdir -p prisma/migrations/add-comments-and-post/
npx prisma migrate diff --from-migrations prisma/migrations --to-schema-datasource prisma/schema.prisma --shadow-database-url   --script >  prisma/migrations/add-comments-and-post/migration.sql

The --shadow-database-url parameter is required and you will need to point it to any empty postgres database either a local one or hosted one. Prisma will use that to reply migration history and calculate the diff.

This will create a new migration in prisma/migrations/add-comments-and-post/migration.sql which will have the SQL for the model you have added via db push.

  1. Now you have the migration ready, we will need to mark it as applied. This is because those tables already exists in the database and we can't run the actual CREATE sql statements to the database. We will just mark the migration as applied as it was already applied when you ran npx prisma db push.
npx prisma migrate resolve --applied add-comments-and-post
  1. Now, you should be ready to go. Run npx prisma migrate dev once now and it should say everything is in sync.
🌐
MCP Servers
mcpservers.org › home › agent skills library › prisma-cli-db-push
prisma-cli-db-push | Agent Skills Library
Pushes schema changes directly to database without creating migrations. Ideal for prototyping. ... Completely resets database and applies schema. prisma db push prisma generate # Must run explicitly in v7
Find elsewhere
🌐
GitHub
github.com › prisma › prisma › issues › 7411
need to run db push twice in order to apply changes · Issue #7411 · prisma/prisma
June 2, 2021 - Then I run db push again, it says once again “Your database is now in sync with your schema”, but now it actually is in sync, and some tables are correctly dropped. ... datasource db { provider = "postgresql" url = "postgresql://postgres:pw@localhost:5340/db" } generator db { provider = "prisma-client-js" } model User { id String @id @default(cuid()) email String name String?
Author   prisma
🌐
DEV Community
dev.to › geraldmuvengei06 › the-case-of-the-frozen-supabaseprisma-db-push-why-your-migrations-might-be-stuck-75j
The Case of the Frozen Supabase/Prisma db push: Why Your Migrations Might Be Stuck - DEV Community
June 11, 2025 - This is what Prisma needs for database migrations and schema pushes. DATABASE_URL: This is your connection string that goes through Supabase's connection pooler (Supavisor). This is ideal for your application's runtime queries, as it efficiently manages connections. When you instruct Prisma to modify your database schema (such as with db push or migrate), it requires a direct, unmediated connection to the database.
🌐
Answer Overflow
answeroverflow.com › m › 1342875401642311801
Switch to migrations after db push - Prisma
February 22, 2025 - Hello , I got a new project from a client , and they are using SQLite , I noticed they do not have any migrations , but rather db push directly , as this is not safe , I want to switch them to migrations , however how can we manage that without losing data as firing the migration will issue a drift
🌐
freeCodeCamp
freecodecamp.org › news › how-to-build-mcp-servers-for-your-internal-data
How to Build MCP Servers for Your Internal Data
March 4, 2026 - const rateLimiter = new Map<string, number[]>(); function checkRateLimit(userId: string, limit = 30, windowMs = 60000) { const now = Date.now(); const calls = rateLimiter.get(userId) ?? []; const recent = calls.filter((t) => now - t < windowMs); if (recent.length >= limit) { throw new Error( `Rate limit exceeded. Max ${limit} calls per minute.` ); } recent.push(now); rateLimiter.set(userId, recent); }
🌐
LogRocket
blog.logrocket.com › home › an introduction to prisma 2
An introduction to Prisma 2 - LogRocket Blog
June 4, 2024 - If your database has no tables ... postgresql, mysql, sqlite, sqlserver or mongodb (Preview). 3. Run prisma db pull to turn your database schema into a Prisma schema....
🌐
GitHub
github.com › vercel › next-forge › issues › 382
npx prisma db push -> dangerous · Issue #382 · vercel/next-forge
January 2, 2025 - Runs npx prisma db push to apply the migration to your database (CAUTION: may destroy / drop tables).
Author   vercel
🌐
Prisma
prisma.io › home › patching & hotfixing › patching & hotfixing › patching & hotfixing › patching & hotfixing
Patching & hotfixing | Prisma Documentation
Patching the production database ... migration history without having to remove and re-apply the hotfix with prisma migrate deploy. This guide does not apply for MongoDB. Instead of migrate dev, db push is used for MongoDB....
🌐
Drizzle ORM
orm.drizzle.team › docs › sql-schema-declaration
Drizzle ORM - Schema
// schema.ts import { snakeCase, camelCase } from 'drizzle-orm/pg-core'; export const users = snakeCase.table('users', { id: serial().primaryKey(), fullName: text(), // → full_name in DB createdAt: timestamp(), // → created_at in DB }); // Available on all entity types: snakeCase.table / snakeCase.view / snakeCase.materializedView / snakeCase.schema camelCase.table / camelCase.view / camelCase.materializedView / camelCase.schema
🌐
Prisma
prisma.io › home › overview of prisma migrate › overview of prisma migrate
Prisma Migrate: Database, Schema, SQL Migration Tool | Prisma Documentation
Prisma Migrate hence provides the flexibility of an imperative migration tool by enabling you to modify what and how migrations are executed (and allows you to run custom SQL to e.g. make use of native database feature, perform data migrations, ...). If you are prototyping, consider using the db push command - see Schema prototyping with db push for examples.
🌐
PlanetScale
planetscale.com › guides › frameworks and orms › prisma › automatic prisma migrations
Automatic Prisma migrations - PlanetScale
1 week ago - From a high level, Prisma’s db push introspects your PlanetScale database to infer and execute the changes required to make your database schema reflect the state of your Prisma schema. When prisma db push is run, it will ensure the schema in the PlanetScale branch you are currently connected to matches your current Prisma schema...
🌐
Fig
fig.io › manual › prisma › db › push
prisma db push | Fig
This command pushes the state of your Prisma schema file to the database without using migrations files
🌐
DEV Community
dev.to › digitaldrreamer › prisma-db-push-or-pull-stuck-1g4j
Prisma db push or pull stuck? - DEV Community
January 7, 2026 - When working with Prisma and Supabase DB, I got an issue with the Prisma CLI getting stuck during prisma db push and prisma db pull.