Skip to content

Prisma migrate - always reporting Data loss / migration file changed even with simple field addition #5551

@webnoob

Description

@webnoob

Say I have a scheme (you already have a copy of my schema for #4748).

Adding a simple field like status Int @default(0) then running migrate. It reports:

image

I can assure you those migration files have not been manually changed since they were applied. This happens without fail for me.

There is no way for me to be able think about using this in production (or even alpha testing) with simple fields being added causing a DB reset.

How to reproduce

Have a scheme (use my example one if needs be as this is the one I've used) and without making any changes, run:

1: npx prisma migrate dev --create-only --preview-feature
2: npx prisma migrate dev --preview-feature

Let it apply the migrations, then add the status field as above to the model Arc in my schema. Then run the above commands again. It will complain with the error in the screenshot.

Environment & setup

  • OS: Windows
  • Database: MySQL 8.0
  • Node.js version: 12
  • Prisma version:
@prisma/cli          : 2.14.0
@prisma/client       : 2.14.0
Current platform     : windows
Query Engine         : query-engine 5d491261d382a2a5ffdc71de17072b0e409f1cc1 (at ..\..\..\..\node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine     : migration-engine-cli 5d491261d382a2a5ffdc71de17072b0e409f1cc1 (at ..\..\..\..\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 5d491261d382a2a5ffdc71de17072b0e409f1cc1 (at ..\..\..\..\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary        : prisma-fmt 5d491261d382a2a5ffdc71de17072b0e409f1cc1 (at ..\..\..\..\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Studio               : 0.332.0

Metadata

Metadata

Assignees

Labels

bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: migratetopic: prisma migrate devCLI: prisma migrate dev

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions