Go into your schema and make the change:

NormalizedName  String            @unique @db.VarChar(64)
NormalizedName  String?            @unique @db.VarChar(64)

Then create a draft migration:

$ npx prisma migrate dev --name migration-name --create-only

Then edit the migration in SQL (this allow null values ie optional)

ALTER TABLE myTable ALTER COLUMN myColumn {DataType} NULL;

OR Postgres

ALTER TABLE myTable ALTER COLUMN myColumn DROP NOT NULL;

etc.

Then apply the modified SQL:

$ npx prisma migrate dev

I hope this works for you :)

Answer from BlaviButcher on Stack Overflow
Discussions

node.js - Make a change to the database with Prisma.js without having to reset the whole thing - Stack Overflow
You can run npx prisma db push instead of running the migration so this will just push the schema updates without making you loose data. 2024-08-21T06:57:30.193Z+00:00 ... Save this answer. ... Show activity on this post. In a development environment, Prisma Migrate sometimes prompts you to reset ... More on stackoverflow.com
🌐 stackoverflow.com
How do I use Prisma without having to wipe my database all the time?
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. More on reddit.com
🌐 r/node
39
34
December 5, 2023
Configuration to disallow database reset
Problem I've started using prisma recently and it seems insanely scary that not only its super easy to reset the entire db but also the fact that doing a migration if it fails due to some sync ... More on github.com
🌐 github.com
15
October 13, 2023
"All data will be lost" ???
``` Prisma Client (v6.8.2) % npx prisma migrate dev --name tenant Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "dbdb", schema "public" at "example.com:54325" The migration `20250521120634_tenant` failed. We need to reset ... More on answeroverflow.com
🌐 answeroverflow.com
May 21, 2025
🌐
Prisma
prisma.io › home › reset › reset › reset
prisma migrate reset | Reset Database & Reapply Migrations | Prisma Documentation
The prisma migrate reset command resets your database and re-applies all migrations. For use in development environments only. This command is not supported on MongoDB. Use db push instead.
🌐
GitHub
github.com › prisma › prisma › discussions › 19185
`prisma migrate dev` prompts me to reset my database, but I just baselined. · prisma/prisma · Discussion #19185
We need to reset the MySQL database "db_name" at "db_host:3306" Do you want to continue? All data will be lost. » (y/N) ... Confirmed the user has the correct permissions. Setting up an explicit shadow db connection url (didn't seem to make any difference). Change line endings on the init migration file before running npx prisma migrate resolve --applied 0_init (I am on a Windows and I thought maybe line endings was messing up the hash when appliying the migration or something)
Author   prisma
🌐
Codú
codu.co › home › niall maher › how to reset and seed a prisma project
How to Reset and Seed a Prisma Project | by Niall Maher | Codú
February 19, 2024 - This command is pretty much the "turn it off and on again" approach, wiping all data in your dev database. Make sure you don't need the data, and then run: npx prisma migrate reset ·
🌐
Basedash
basedash.com › home › blog › how to reset and seed a prisma database
How to reset and seed a Prisma database | Basedash
January 31, 2025 - When you want to revert your database to its initial state or apply new changes to the Prisma schema, you might need to reset it.
🌐
Prisma
prisma.io › home › prisma cli reference › prisma cli reference › prisma cli reference
Prisma CLI reference | Prisma Documentation
Drops the database/schema if possible, or performs a soft reset if the environment does not allow deleting databases/schemas · Creates a new database/schema with the same name if the database/schema was dropped ... This command is not supported on MongoDB. Use db push instead.
Find elsewhere
🌐
Fig
fig.io › manual › prisma › migrate › reset
prisma migrate reset | Fig
Reset your database and apply all migrations, all data will be lost
🌐
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
🌐
Build with Matija
buildwithmatija.com › blog › solving-database-drift-in-postgresql-17-with-prisma-without-losing-data
Solving Database Drift in PostgreSQL 17 With Prisma Without Losing Data | Build with Matija
January 13, 2025 - Using migrations after db push causes inconsistencies: Prisma compares the database schema against the migration history and identifies mismatches. Prisma’s solution is often to reset the database: Resetting deletes all data to start fresh, which is unacceptable in most cases.
🌐
GitHub
github.com › prisma › prisma › issues › 21483
Configuration to disallow database reset · Issue #21483 · prisma/prisma
October 13, 2023 - Some configuration on the connection or something should exist to prevent this behaviour. If in the datasource there's a preserveDB or preventDBReset or something like it, prisma should never suggest to reset db when running any command besides prisma reset db and even then it should ask more then once if we are sure of the concequences.
Author   prisma
🌐
Prisma
prisma.io › home › troubleshooting › troubleshooting › troubleshooting › troubleshooting
Troubleshooting | Prisma Documentation
If Prisma Migrate detects a migration history conflict when you run prisma migrate dev, the CLI will ask to reset the database and reapply the migration history. Database schema drift occurs when your database schema is out of sync with your migration history - the database schema has 'drifted away' from the source of truth. ... The database schema was changed without using migrations - for example, by using prisma db push or manually changing the database schema.
🌐
Answer Overflow
answeroverflow.com › m › 1374724304813690922
"All data will be lost" ??? - Prisma
May 21, 2025 - Prisma Client (v6.8.2) % npx prisma ... need to reset the "public" schema at "example.com:54325" You may use prisma migrate reset to drop the development database....
🌐
Stack Overflow
stackoverflow.com › questions › 73292180 › prisma-io-erasing-data-when-migrate-prod-database › 73292595
node.js - PRISMA.IO - Erasing data when migrate prod database - Stack Overflow
I'm pretty sure the answer will ... with a sqlite database. Each time I run the command "npx prisma db push" all my data are erased. And I can't find a solution to migrate my production database without resetting the data ?...
🌐
Fly.io
community.fly.io › t › how-to-reset-my-litefs-db-on-deploy › 13815
How to reset my litefs db on deploy - litefs - Fly.io
June 27, 2023 - But with the new support for litefs, ... my Dockerfile as follows: # remove this line after launch RUN npx prisma db push --force-reset && npx prisma db push # replace it with this line afte......