PrismaP
Prisma2w ago
1 reply
ZeyN

Prisma migration drift detected after Git rollback – cannot reset production DB

Hello everyone,

I’m looking for some guidance on a Prisma migration issue that is currently blocking further development.

Context:
The project already had two Prisma migrations applied in the database. Due to unavoidable circumstances, I had to roll back to a previous Git commit, which caused those migration folders to be lost locally. Later, I managed to recover them from GitHub.

After that, I updated the Prisma schema and added a new field called fee_christmas. To generate the new migration, I ran:

npx prisma migrate dev --name add_fee_christmas


However, Prisma returns the following error:

The migration 20251217215058_add_fields_reservation was modified after it was applied.

The migration 20251217220321_update_boolean_string_return_warranty was modified after it was applied.

Prisma then asks to reset the public schema.

Problem:
I cannot run prisma migrate reset because this is a production database with more than 300,000 records. A reset has already been done once before, and I want to avoid repeating it due to the total data loss it implies.

Questions:

What is the correct way to proceed to apply this new schema change without losing existing data?

Is there a recommended approach for this scenario (e.g. prisma migrate resolve, manual SQL migrations, shadow database, etc.)?

Any guidance or shared experience would be greatly appreciated. This is a fairly urgent issue.

Thanks in advance.
Was this page helpful?