#34336 closed Bug (needsinfo)

Reverting a migration with `replaces = [...]` set does not revert it

Reported by: Thomas C Owned by: nobody
Component: Migrations Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Thomas C)

I have four migrations in an app. In migration 4, I have replaces = [("my_app", "0002_foo")].

When I migrate back from the state where all migration are applied to the first migration, it says that the migration 4 has been reverted.

However, that migration is still marked as passed in the django_migrations table and when I try to migrate again to the state 4 it fails saying that migration 4 was already applied.

Is rollbacking a migration where replaces is set supported? How is that supposed to behave, regarding the migration and the one it replaces?

Change History (2)

comment:1 by Thomas C, 23 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 23 months ago

Resolution: needsinfo
Status: newclosed

However, that migration is still marked as passed in the django_migrations table and when I try to migrate again to the state 4 it fails saying that migration 4 was already applied.

Reverting squashed migrations works for me. Did you manually add the replaces attribute? Please reopen the ticket if you can debug your issue and provide a small project that reproduces it.

Note: See TracTickets for help on using tickets.
Back to Top