Prisma Migrate shows warning when editing rolled-back migration #9829
Labels
bug/1-unconfirmed
Bug should have enough information for reproduction, but confirmation has not happened yet.
kind/bug
A reported bug.
team/schema
Issue for team Schema.
topic: dx
topic: prisma migrate deploy
CLI: prisma migrate deploy
Milestone
Bug description
When a migration failed to apply on a production system, the documentation tells you that one solution for this problem is to mark the migration as rolled-back, then change the migration (e.g. by adding
IF NOT EXIST
) and then callprisma migrate deploy
again.This leads to two entries in the
_prisma_migrations
table, one for the original, failed migration with the old checksum which has arolled_back_at
date. The other entry is for the same file, but with the new, edited checksum.However, whenever you run
prisma migrate deploy
again, the warningis always shown. It is not possible to get rid of this warning (unless you manually delete the rolled-back entry from
_prisma_migrations
which is something we definitely want to avoid in a production db). The solution in the documentation for this warning is to "restore the old file" which obviously doesn't work since it's broken. Just ignoring the warning is also not a solution because it might be a legitimate problem - if it's not a rolled-back migration.How to reproduce
npx prisma migrate dev --create-only
npx prisma migrate deploy
npx prisma migrate deploy
againExpected behavior
The "The following migrations have been modified since they were applied" warning should only trigger on entires in the
_prisma_migrations
table that are not marked as rolled-back.Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: