You can use the --create-only option to generate the migration file without applying it to the database. So the command will look like this:
npx prisma migrate dev --create-only
You can find more details in the reference for Prisma Migrate in the docs.
npx prisma migrate dev --create-only
how to generate a migration file with prisma - Stack Overflow
`migrate dev --create-only` doesn't work in the first time on an existing database
Running `prisma migrate dev --create-only` actually applies previous (non-deployed) migrations
I know this was a while ago but the fix is to first make a change in your schema.prisma file. Add whatever changes you need. Then run the command you are running. It will then notice the changes you made on the file and generate the SQL needed to achieve that change. Hope this helps.
Are you trying to do an empty migration? Try using
prisma migrate dev --create-only
doc
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!