Think of it like this: You have a table with some users, none of which have a last name. Now you update schema.prisma with a required column called lastName, without a default value. How should Prisma handle the migration for you? Since Prisma can't guess the last name of every user, the only reasonable thing it can do is to ask you to recreate the data—which means resetting that table. To work around that, you need two migrations. You first set the column's default value to a placeholder—ensuring every row has a value. You then make a second migration where you remove the default value. This is, of course, just one of many reasons for why Prisma would want to reset a table, or sometimes even the whole database (if the effect is large enough). Prisma migrations are great, and they make life so much easier! But you still need to consider how they are applied and design your database accordingly: Prisma won't be able to magically solve the logical impossibilities that may occur otherwise. So, just like with everything else in programming, you need to be careful and considerate, and the more you practice; the easier it gets. I think Prisma sometimes overpromises on "making database design easy". It sure makes it easier, but you still need to think about what's going on behind the scenes. The way it abstracts the database design behind a neat little schema—together with its automatic migrations—can sometimes make you miss the forest for all the trees. Answer from die-maus on reddit.com
🌐
Prisma
prisma.io › home › development and production › development and production › development and production › development and production
Development and production | Prisma Documentation
You want to rename a field (by ... Language - such as a stored procedure or a trigger. The --create-only command allows you to create a migration without applying it:...
Discussions

how to generate a migration file with prisma - Stack Overflow
I tried this in the repository's prisma folder npx prisma migrate dev --name add_finance_tables but it shows this in the terminal ** Environment variables loaded from .env Prisma schema loaded from More on stackoverflow.com
🌐 stackoverflow.com
Is there a way to generate prisma migrations without applying them immediately?
Sometimes I need to apply Prisma migrations that do not only require a DDL change, but also some additional SQL statements I'd need to add in to migrate data. For instance when splitting a field into multiple columns, for setting an initial value to a column after it's been introduced (without ... More on answeroverflow.com
🌐 answeroverflow.com
February 25, 2025
`migrate dev --create-only` doesn't work in the first time on an existing database
Bug description I want to try prisma as a migrate tool in an existing non-prisma project. so I've run prisma db pull on an existing database and got the schema.prisma file, then I want to make ... More on github.com
🌐 github.com
7
March 11, 2022
Where do you actually run prisma migrate deploy?
If you want an easy way to develop, I can recommend Planetscale which has a very generous free tier. It's a mysql db service that has branches like your code. That means you can develop code locally, run prisma db push and then merge the dev branch of your db into prod when you want. More on reddit.com
🌐 r/node
18
4
December 11, 2022
🌐
Reddit
reddit.com › r/node › how do i use prisma without having to wipe my database all the time?
r/node on Reddit: How do I use Prisma without having to wipe my database all the time?
December 5, 2023 -

I'm using Prisma for a large project I've been working on for the past few months, and I still don't understand the flow of it. At first I was migrating every time I made a change to my schema, and constantly getting the "All data will be lost" prompt. Since then I've learned to use `db push` while developing and then migrate when a feature is finished, but it's still constantly making me reset my database.

Right now I'm using the same db for dev and staging (because I don't want to pay for 2 different ones) but I'd imagine this would still be an issue if I had separate databases. What do I need to do to stop being forced to reset my db? Or, at least, how would I migrate my development db to mirror my production db without it being wiped?

As you can probably tell, this is my first time working with Prisma (or any ORM, in depth) so this might be a stupid question, but I can't find much online besides general tutorials. Any help would be greatly appreciated!

Top answer
1 of 5
23
Think of it like this: You have a table with some users, none of which have a last name. Now you update schema.prisma with a required column called lastName, without a default value. How should Prisma handle the migration for you? Since Prisma can't guess the last name of every user, the only reasonable thing it can do is to ask you to recreate the data—which means resetting that table. To work around that, you need two migrations. You first set the column's default value to a placeholder—ensuring every row has a value. You then make a second migration where you remove the default value. This is, of course, just one of many reasons for why Prisma would want to reset a table, or sometimes even the whole database (if the effect is large enough). Prisma migrations are great, and they make life so much easier! But you still need to consider how they are applied and design your database accordingly: Prisma won't be able to magically solve the logical impossibilities that may occur otherwise. So, just like with everything else in programming, you need to be careful and considerate, and the more you practice; the easier it gets. I think Prisma sometimes overpromises on "making database design easy". It sure makes it easier, but you still need to think about what's going on behind the scenes. The way it abstracts the database design behind a neat little schema—together with its automatic migrations—can sometimes make you miss the forest for all the trees.
2 of 5
19
bruh
🌐
GitHub
github.com › prisma › prisma › discussions › 24571
How should migration be done to Production? · prisma/prisma · Discussion #24571
In your development environment, you use prisma migrate dev --create-only to create a migration file without applying it. This command generates the migration.sql file based on the changes in your schema.prisma.
Author   prisma
🌐
Prisma
prisma.io › home › customizing migrations › customizing migrations › customizing migrations › customizing migrations
Customizing migrations | Prisma Documentation
bunx prisma migrate dev --name rename-migration --create-only · Edit the draft migration as shown, changing DROP / DELETE to a single RENAME COLUMN: Before · After · migration.sql · ALTER TABLE "Profile" DROP COLUMN "biograpy", ADD COLUMN "biography" TEXT NOT NULL; Save and apply the migration: bun ·
🌐
Prisma
prisma.io › home › dev › dev › dev
prisma migrate dev | Create & Apply Migrations | Prisma Documentation
Prisma v7: migrate dev no longer automatically triggers prisma generate or seed scripts. Run them explicitly if needed. If a schema drift is detected while running with --create-only, you will be prompted to reset your database.
🌐
LogRocket
blog.logrocket.com › home › effortless database schema migration with prisma
Effortless database schema migration with Prisma - LogRocket Blog
June 4, 2024 - There are 1 rows in this table, it is not possible to execute this step. You can use prisma migrate dev --create-only to create the migration file, and manually modify it to address the underlying issue(s).
Find elsewhere
🌐
Prisma
prisma.io › home › getting started with prisma migrate › getting started with prisma migrate › getting started with prisma migrate
Getting started with Prisma Migrate | Prisma Documentation
This should already be true if you are using a previous version of Prisma Migrate. ... Create a baseline migration that creates an initial history of the database before using Prisma migrate. This migrations contains the data that must be maintained, which means the database cannot be reset.
🌐
Answer Overflow
answeroverflow.com › m › 1344042560368148626
Is there a way to generate prisma migrations without applying them immediately? - Wasp
February 25, 2025 - Sometimes I need to apply Prisma migrations that do not only require a DDL change, but also some additional SQL statements I'd need to add in to migrate data. For instance when splitting a field into multiple columns, for setting an initial value to a column after it's been introduced (without ...
🌐
GitHub
github.com › prisma › prisma › issues › 12272
`migrate dev --create-only` doesn't work in the first time on an existing database · Issue #12272 · prisma/prisma
March 11, 2022 - npx prisma migrate dev --create-only · the docs says · The --create-only command allows you to create a migration without applying it · but when I do so, it says · Drift detected: Your database schema is not in sync with your migration history. ...
Author   prisma
🌐
Medium
medium.com › @bryantbrock › data-migrations-with-prisma-94909cb0c0c0
Data migrations with Prisma. For production applications (and… | by Bryant Brock | Medium
December 19, 2023 - Second, run npx prisma migrate devto create the migration file. Finally, deploy your application — only running the new migration is necessary, but for most of us, that will simply be another release (since migrations and code releases should ...
🌐
Prisma
prisma.io › home › overview of prisma migrate › overview of prisma migrate
Prisma Migrate: Database, Schema, SQL Migration Tool | Prisma Documentation
Imperative: All generated SQL migration files are fully customizable. 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.
🌐
npm
npmjs.com › package › @prisma › migrate
@prisma/migrate - npm
March 27, 2026 - Migrations are auto-generated based on the Prisma schema changes but are fully customizable.
      » npm install @prisma/migrate
    
Published   Apr 22, 2026
Version   7.8.0
🌐
Fig
fig.io › manual › redwood › prisma › migrate › dev
redwood prisma migrate dev | Fig
The migrate dev command updates your database using migrations files during development
🌐
YouTube
youtube.com › watch
Prisma Migrations: A Step-by-Step Guide - YouTube
If you're using Prisma ORM, there's a good change that you'll also be using Prisma Migrate. But what are migrations and how do we work with them in Prisma?Le...
Published   January 22, 2025
🌐
Reddit
reddit.com › r/node › where do you actually run prisma migrate deploy?
r/node on Reddit: Where do you actually run prisma migrate deploy?
December 11, 2022 -

I'm working on a little project with supabase and prisma, I've just been using one dev database which I update with prisma migrate dev. For production migrations, you're supposed to use prisma migrate deploy, which the prisma docs say to put in a CI/CD pipeline.

  • I don't have a CI/CD pipeline

  • I can't run it locally from my project directory, cause prisma uses the DATABASE_URL environment, which is pointing to my dev database

So I'm wondering where y'all would actually run prisma migrate deploy from? Should I just bite the bullet and learn some github actions? Or is there an easier way?

EDIT: The prisma docs recommend using dotenv-cli to use switch between .env files, but I'm kinda worried that I might fuck up somehow and end up running prisma migrate reset on my prod database, and delete everything. But, seems like that might be my plan until I figure out some CI/CD stuff.

Still definitely open to any advice though!

🌐
GitHub
github.com › prisma › prisma › issues › 17558
`prisma migrate resolve --applied` not working on new ...
The final step npx prisma migrate resolve --applied 0_init leads to the following error: ... The migration 0_init could not be found. Please make sure that the migration exists, and that you included the whole name of >the directory. (example: "20201207184859_initial_migration") The database (in my case) is mssql - if it makes any difference. The steps before (pulling, generating, creating ...
Author   prisma
🌐
PlanetScale
planetscale.com › guides › frameworks and orms › prisma › automatic prisma migrations
Automatic Prisma migrations - PlanetScale
2 weeks ago - Run npx prisma init inside of your project to create the initial files needed for Prisma. Install the PlanetScale CLI. ... Prisma migrations follow the PlanetScale non-blocking schema change workflow.