Opened 5 years ago

Closed 5 years ago

#28351 closed Bug (needsinfo)

"Conflicting migrations detected" CommandError due to replacement Migration being removed

Reported by: Daniel Hahler Owned by: Windson yang
Component: Migrations Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am getting the following error:

CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0002_initial_models, 0XXX_merge_20170628_1435 in myapp).
To fix them run 'python manage.py makemigrations --merge'

Running the command results in No conflicts detected to merge. however.

0002_initial_models is not actually a leaf node, but 0003_initial_data depends on it.
0003_initial_data however is removed, since it replaces 0XXX_merge_20170628_1435, which is not applied yet and therefore also does not show up in showmigrations?!
(it gets removed in https://github.com/django/django/blob/a6756195c1a11eee10c16c96fe95d52e22e1d9ba/django/db/migrations/graph.py#L252)

I think 0003_initial_data should still show up in showmigrations, but with some indication that it replaces other migrations.
That would happen in case it wasn't removed as a leaf node in https://github.com/django/django/blob/a6756195c1a11eee10c16c96fe95d52e22e1d9ba/django/core/management/commands/showmigrations.py#L82-L83.

Change History (6)

comment:1 Changed 5 years ago by Tim Graham

Can you provide more explicit steps to reproduce the problematic situation?

comment:2 Changed 5 years ago by Daniel Hahler

Not currently.

I think a fix might be to move over the replaces from the node that gets replaced, and/or only to replace up to the parent that got applied in https://github.com/django/django/blob/a6756195c1a11eee10c16c96fe95d52e22e1d9ba/django/db/migrations/graph.py#L243-L245.

comment:3 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

Tentatively accepting. Might be difficult to proceed without steps to reproduce unless you plan to offer a patch.

comment:4 Changed 5 years ago by Windson yang

Owner: changed from nobody to Windson yang
Status: newassigned

comment:5 Changed 5 years ago by Windson yang

I need more details to fix this bug.

comment:6 Changed 5 years ago by Tim Graham

Resolution: needsinfo
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top