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.
GitHub
github.com › prisma › prisma › issues › 18236
npx prisma migrate dev --create-only · Issue #18236 · prisma/prisma
March 6, 2023 - Bug description so this --create-only is not working and it still asks for wiping the data How to reproduce by running "npx prisma migrate dev --create-only" this cmd Expected behavior No response Prisma information model ui_account { id...
Author prisma
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
Create migration file without applying it
Not sure If I'm missing something ... like prisma migrate dev except not applying it to the database? Feels weird that it's applied generated and applied instantly without the chance of reviewing the generated migration file. Beta Was this translation helpful? Give feedback. ... You can use the --create-only option to ... More on github.com
Running `prisma migrate dev --create-only` actually applies previous (non-deployed) migrations
Bug description Imagine a situation where you are iterating on your schema, and using the following command to create the migration files without actually applying any of them. prisma migrate dev --create-only Suppose you initially run i... More on github.com
`prisma migrate dev --create-only` executed previously created migrations
Bug description prisma migrate dev --create-only commits migrations previously created with --create-only. This is not exactly a bug, but it's unexpected behavior. I should be able to decide wh... More on github.com
Baselining: prisma migrate dev --create-only asks for RESET DB
Bug description i have an existing database. Created the schema for it with prisma db pull. But then when trying to create a migration baseline running prisma migrate dev it asks to reset the database... adding --create-only doesn't seem... More on github.com
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 - bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.tech/enginesIssue for tech Engines.Issue for tech Engines.topic: drifttopic: prisma migrate dev --create-onlyCLI: prisma migrate dev --create-onlyCLI: prisma migrate dev --create-only
Author prisma
GitHub
github.com › prisma › prisma › issues › 11184
Running `prisma migrate dev --create-only` actually applies previous (non-deployed) migrations · Issue #11184 · prisma/prisma
January 15, 2022 - Bug description Imagine a situation where you are iterating on your schema, and using the following command to create the migration files without actually applying any of them. prisma migrate dev --create-only Suppose you initially run i...
Author prisma
Prisma
prisma.io › home › customizing migrations › customizing migrations › customizing migrations › customizing migrations
Customizing migrations | Prisma Documentation
-- DropForeignKey ALTER TABLE "Profile" DROP CONSTRAINT "Profile_userId_fkey"; -- DropIndex DROP INDEX "Profile_userId_unique"; -- AlterTable ALTER TABLE "Profile" DROP COLUMN "userId"; -- AlterTable ALTER TABLE "User" ADD COLUMN "profileId" INTEGER NOT NULL; -- CreateIndex CREATE UNIQUE INDEX "User_profileId_unique" ON "User"("profileId"); -- AddForeignKey ALTER TABLE "User" ADD FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; Save and apply the migration: bun · pnpm · yarn · npm · bunx prisma migrate dev · Edit on GitHub ·
GitHub
github.com › prisma › prisma › issues › 14746
Baselining: prisma migrate dev --create-only asks for RESET DB · Issue #14746 · prisma/prisma
August 10, 2022 - have a simple database (mysql) do npx prisma db pull then prisma migrate dev --name initial-migration --create-only
Author prisma
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
Edit on GitHub · Overview of Prisma Migrate · Learn everything you need to know about Prisma Migrate · Understanding Migrations · A mental model guide for working with Prisma Migrate in your project · Adding to a new projectCreate an initial migrationAdditional migrationsCommitting to versions controlAdding to an existing projectIntrospect to create or update your Prisma schemaCreate a baseline migrationWork around features not supported by Prisma Schema LanguageApply the initial migrationsCommit the migration history and Prisma schemaGoing furtherWhere to go next
GitHub
github.com › prisma › prisma › issues › 6579
`migrate dev --create-only` with empty schema but existing database schema detects drift and warns about deleting all data · Issue #6579 · prisma/prisma
April 14, 2021 - ... yes √ Name of migration ... init Prisma Migrate created the following migration without applying it 20210414181550_init You can now edit it and apply it by running prisma migrate dev. --create-only needing to reset my database, and supposedly even doing that, was unexpected.
Author prisma
GitHub
github.com › prisma › docs › issues › 6181
update doc about creating a migration (an empty migration to be more precise) · Issue #6181 · prisma/docs
August 7, 2024 - For --create-only flag. So I though I cannot use it for creating an empty migration file. Then I read this Stackoverflow Q&A and tried it. Surprisingly they were right about it; you can create an empty migration without the need to have anything changed in schema.prisma.
Author prisma
GitHub
github.com › prisma › prisma › discussions › 28943
How to use Prisma migrations to add new models on an existing Laravel-managed MySQL database without data loss · prisma/prisma · Discussion #28943
December 23, 2025 - Next, create a migration file that records these changes without actually applying them (since they already exist in the database). You can do this with npx prisma migrate dev --create-only --name fix_drift.
Author prisma
GitHub
github.com › prisma › prisma › issues › 4748
Prisma `migrate dev` prompts for migration name when running after --create-only · Issue #4748 · prisma/prisma
December 21, 2020 - Then when you run prisma migrate dev --preview-feature to apply the changes (without changing the SQL), you are prompted for a migration name. Once entered, everything applies but you end up with a migration file that just drops and adds FK's. I assume this is because you're expecting --create-only to only be used as a precursor to manual sql changes being made to the generated SQL files but that's not the case with me - it's just easier to build into my flow and I also like to check the SQL before it's applied.
Author prisma
GitHub
github.com › prisma › prisma › discussions › 21479
Adapting a single migration to include data creation/manipulation · prisma/prisma · Discussion #21479
You will use the --create-only flag and then add the changes you want. Read more · Q5: If the complexity lent itself better to a script, is there a way to run a script to do the same task ONCE just at the point of the migration?
Author prisma
GitHub
github.com › prisma › prisma › discussions › 12792
Is there a way to migrate after pulling existing database without loosing data? · prisma/prisma · Discussion #12792
April 13, 2022 - @janpio it seems like baselining needs a migration file to skip and even with prisma migrate dev --name initial-migration --create-only after prisma db pull following this instruction for that, I get the same error. it feels like --create-only option is not working.
Author prisma
GitHub
github.com › prisma › prisma › issues › 24491
Prisma Multiple Schema Migrations · Issue #24491 · prisma/prisma
June 11, 2024 - I splitted my existing scheme with already applied migrations, I decided to check what would happen if I called the command npx prisma migrate dev --create-only --skip-generate --schema prisma There are no changes to the models. As a res...
Author prisma
GitHub
github.com › prisma › prisma › discussions › 20607
How to migrate with a new required column without default value when there are existing rows? · prisma/prisma · Discussion #20607
I agree that you would need to create a new migration using prisma migrate dev --create-only. This will generate a new migration file in your prisma/migrations directory. You can then modify the migration script.
Author prisma