You can follow these steps to generate the initial migration without resetting your database.

mkdir -p prisma/migrations/init
npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script > prisma/migrations/init/migration.sql
npx prisma migrate resolve --applied init
npx prisma migrate dev # it should say everything is in sync
Answer from Nurul Sundarani on Stack Overflow
🌐
Prisma
prisma.io › home › prisma cli reference › prisma cli reference › prisma cli reference
Prisma CLI reference | Prisma Documentation
CREATE NEW DATABASE: Local: npx ... database) Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema....
Discussions

`npx prisma migrate dev --name init` fails in starter project
Bug description I was following this instruction in the setup page: "Set up your database (schema migration) Initialize your new database by running a schema migration to create the necessary tables from the sample project. npx prisma mi... More on github.com
🌐 github.com
1
January 9, 2025
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
npx prisma migrate dev --name init from tutorial not working
Once I get to the part in the supabase prisma tutorial where I run the command npx prisma migrate dev --name initnpx prisma migrate dev --name init the terminal gets stuck at: More on answeroverflow.com
🌐 answeroverflow.com
May 29, 2024
Command `npx prisma migrate dev` failing with no error messages
Bug description Well, i started a project here and i was trying to set up my first table on my schema I have already used Prisma in the past and worked fine, but today, on the latest version, it... More on github.com
🌐 github.com
10
May 28, 2024
🌐
Neon
neon.com › docs › guides › prisma-migrations
Schema migrations with Prisma and Neon - Neon Docs
Modify your schema: Update models in prisma/schema.prisma · Generate migration: Run npx prisma migrate dev --name descriptive-name
🌐
GitHub
github.com › prisma › prisma › issues › 26014
`npx prisma migrate dev --name init` fails in starter project · Issue #26014 · prisma/prisma
January 9, 2025 - in the command line, run npx prisma migrate dev --name init · This bug report was generated after receiving an error. The database should be overwritten. I did this because I was trying to add new models and stream changes on the table.
Author   prisma
🌐
GitHub
github.com › prisma › prisma › issues › 17558
`prisma migrate resolve --applied` not working on new ...
Here is what I'm doing: 1. `npx prisma db pull` -- Populates schema.prisma correctly 2. `npx prisma generate` -- Success generating 3. `mkdir -p prisma/migrations/init` 4. `npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script > prisma/migrations/init/migration.sql` -- Creates migration.sql file in prisma/migrations/init directory 5.
Author   prisma
🌐
Medium
medium.com › @fardeenmansuri0316 › prisma-for-beginners-setting-up-migrating-and-querying-data-050fc401fa0d
Prisma for Beginners: Setting Up, Migrating, and Querying Data | by Fardeen Mansoori | Medium
February 21, 2025 - After initializing Prisma, define a table (model) inside the schema.prisma file. Here’s an example: model User { id Int @id @default(autoincrement()) email String @unique name String? profile Profile?
Find elsewhere
🌐
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!

🌐
Shiftinc
note.shiftinc.jp › 【node.js】prisma(orm)を使ってdbマイグレーションをやってみた
[Node.js] Trying out DB migration using Prisma (ORM)|SHIFT Group 技術ブログ
January 6, 2024 - After that, you just need to execute the "npx prisma migrate dev --name init" command as follows (in the image below, @prisma/client is added to dependencies, but this is because the "--skip-generate" option was not used when executing prisma ...
🌐
PlanetScale
planetscale.com › guides › frameworks and orms › prisma › automatic prisma migrations
Automatic Prisma migrations - PlanetScale
1 week ago - Add Prisma to your project using npm install prisma --save-dev or yarn add prisma --dev (depending on what package manager you prefer). Run npx prisma init inside of your project to create the initial files needed for Prisma.
🌐
Answer Overflow
answeroverflow.com › m › 1245268096017764413
npx prisma migrate dev --name init from tutorial not working - Prisma
May 29, 2024 - Environment variables loaded from ... non-pooled connection string, the one with port 5432 and check? ... No, you can. You just need a direct URL (as in not a pooled connection) for migrations....
🌐
LogRocket
blog.logrocket.com › home › effortless database schema migration with prisma
Effortless database schema migration with Prisma - LogRocket Blog
June 4, 2024 - This is primarily because we have one or more rows in the users table and the migration generated by Prisma is potentially destructive. To prevent this, Prisma prompts us to create the migration file without syncing it to the database immediately. We can do this by running: npx prisma migrate dev --name update-biography --create-only
🌐
GitHub
github.com › prisma › prisma › discussions › 24571
How should migration be done to Production? · prisma/prisma · Discussion #24571
mkdir -p prisma/migrations/0_init npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
Author   prisma
🌐
egghead.io
egghead.io › lessons › prisma-install-and-set-up-prisma-for-a-new-project
Install and Set up Prisma for a New Project | egghead.io
[1:38] Since we're starting with an empty database, we'll use the npx prisma migrate save command to prepare the mapping of new database tables to our data models. We'll also give this first migration a name called init.
🌐
GitHub
github.com › prisma › prisma › issues › 24305
Command `npx prisma migrate dev` failing with no error messages · Issue #24305 · prisma/prisma
May 28, 2024 - This is what i got when i run npx run migrate dev · No response · // This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model Account { id String @id @default(uuid()) @db.Uuid name String email String @unique password String @@map("accounts") } OS: Pop OS ·
Author   prisma
🌐
GitHub
github.com › prisma › prisma › discussions › 19185
`prisma migrate dev` prompts me to reset my database, but I just baselined. · prisma/prisma · Discussion #19185
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
🌐
Prisma
prisma.io › home › overview of prisma migrate › overview of prisma migrate
Prisma Migrate: Database, Schema, SQL Migration Tool | Prisma Documentation
February 14, 2023 - Prisma Migrate is a database migration tool available via the Prisma CLI that integrates with Prisma schema for data modeling.