question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

misleading message during prisma migrate dev --create-only

See original GitHub issue

Bug description

when I change the column name and run npx prisma migrate dev --create-only the message shown in the console is that the data will be deleted, but its job is to only create a migration file

2021-05-26 23_11_01-schema prisma - postgres-prisma-todo - Visual Studio Code

Environment & setup

  • OS:
  • Database:
  • Node.js version:
  • OS: Windows 10
  • Database: PostgreSQL
  • Node.js version: 14.16.1

Prisma Version

2.23.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ryands17commented, May 28, 2021

@sairaj2119 👋

The message is indeed misleading as prisa migrate dev --create-only doesn’t delete data from the database.

@pantharshit00 To reproduce:

  1. Create a sample schema:
model User {
  id Int @id @default(autoincrement())
  name String
}
  1. Run migrate: prisma migrate dev

  2. Seed some sample data

  3. Update the model

model User {
  id Int @id @default(autoincrement())
  fullName String
}
  1. Run prisma migrate dev --create-only. You will get a warning in the terminal that data will be lost. Press y to confirm.

  2. Check the database and data still persists

The main issue here is we can change the messaging for --create-only as data is not lost when just creating the migration.

1reaction
tomhoulecommented, Jun 30, 2021

We should change the message, but the warnings are still applicable because it’s what is going to happen when you later apply the migration that was created.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >
Command Line Interface | RedwoodJS Docs
Prisma Migrate lets you use Prisma schema to make changes to your database declaratively, all while keeping things deterministic and fully customizable by ......
Read more >
Prisma 2.19.0 Release - GitClear
Besides making Prisma Migrate ready for production in this release, it comes with a number of smaller fixes and improvements: After migrate dev...
Read more >
How To Build a REST API with Prisma and PostgreSQL
You can also customize the generated SQL migration file if you add the --create-only option to the prisma migrate dev command; for example, ......
Read more >
How To Use Prisma with PostgreSQL, SQLite, and MySQL 2022
The Prisma migrate tool takes the models defined in the schema file ... prisma migrate dev --name user-entity --create-only && npx prisma ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found