Opened 6 years ago

Closed 6 years ago

#29180 closed Bug (fixed)

makemigrations autodetector ignoring existing migrations

Reported by: Collin Anderson Owned by: nobody
Component: Migrations Version: dev
Severity: Release blocker Keywords:
Cc: cmawebsite@…, Collin Anderson, Carlton Gibson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I don't have a minimal case to reproduce this issue, but I've bisected the issue to a38ae914 (#28996) and narrowed it down to this change:

diff --git a/django/db/migrations/graph.py b/django/db/migrations/graph.py
index aba8259..db8a529 100644
--- a/django/db/migrations/graph.py
+++ b/django/db/migrations/graph.py
@@ -367,9 +367,7 @@ class MigrationGraph:
         plan = []
         for node in nodes:
             for migration in self.forwards_plan(node):
-                if migration not in plan:
-                    if not at_end and migration in nodes:
-                        continue
+                if migration in plan or at_end or migration not in nodes:
                     plan.append(migration)
         project_state = ProjectState(real_apps=real_apps)
         for node in plan:

I think believe the correct logic should be:

if migration not in plan and (at_end or migration not in nodes):
    plan.append(migration)


Change History (6)

comment:1 by Collin Anderson, 6 years ago

Cc: Collin Anderson added
Needs tests: set

comment:2 by Tim Graham, 6 years ago

Summary: Makemigrations autodetector ignoring existing migrationsmakemigrations autodetector ignoring existing migrations
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

comment:3 by Carlton Gibson, 6 years ago

Cc: Carlton Gibson added

comment:4 by Carlton Gibson, 6 years ago

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:5 by Carlton Gibson <carlton.gibson@…>, 6 years ago

In 4d420a53:

Refs #29180 -- Added MigrationGraph._generate_plan() for testing.

comment:6 by Carlton Gibson <carlton.gibson@…>, 6 years ago

Resolution: fixed
Status: newclosed

In 5b083a82:

Fixed #29180 -- Fixed a regression where migrations already in the plan were readded.

Regression in a38ae914d89809aed6d79337b74a8b31b6d3849a.

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