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.

`npx prisma migrate dev --create-only` actually resets database

See original GitHub issue

It tells you it will do it:

...
√ Drift detected: Your database schema is not in sync with your migration history.

[+] Added tables
  - Buyer
  - BuyerGroup

[*] Changed the `Buyer` table
  [+] Added foreign key on columns (buyerGroupId)


We need to reset the PostgreSQL database "emerald_jellyfish" at "pg-db-provision.cm0mkpwj8arx.eu-central-1.rds.amazonaws.com:5432".
Do you want to continue? All data will be lost. ... yes
...

But in the end it is still surprising that a command that is supposed to only create a migration (file), modifies the database.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tomhoulecommented, Jul 4, 2021

One more issue to file into “works as intended, but counter-intuitive”.

0reactions
romgrk-comparativecommented, Mar 4, 2022

I can’t test the diffing tool anymore but will do on the next occasion I have.

What’s weird is, once the migration file was created, npx prisma migrate deploy had no issue applying the migration without resetting the (production) database. It really only wanted to reset the database to create the migration file. I chose to say ok for the reset using the development database, for which I have reset/repopulate scripts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma Migrate | Database, Schema, SQL Migration Tool
Prisma Migrate is a database migration tool available via the Prisma CLI that integrates with Prisma schema for data modeling.
Read more >
migrate dev --create-only doesn't work in the first time on an ...
As part of adding Prisma Migrate to your development environment, you must reset your development database. This will result in data loss in...
Read more >
Effortless database schema migration with Prisma
Learn how to use Prisma Migrate to perform database schema migrations, reducing the tedium (and improving the performance) of your code.
Read more >
Make a change to the database with Prisma.js without having ...
Resetting drops and recreates the database, which results in data loss. The database is reset when: You call prisma migrate reset explicitly ...
Read more >
It's Prisma Time - Migrations - DEV Community ‍ ‍
Prisma Migrate is an imperative database schema migration tool that ... npx prisma migrate dev --name rename_author_columns --create-only.
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