Opened 22 months ago

Last modified 15 months ago

#28535 assigned Cleanup/optimization

Message on conflicting migrations is misleading for rebase workflows

Reported by: karyon Owned by: Masashi SHIBATA
Component: Migrations Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When there are conflicting migrations, it says

Conflicting migrations detected; multiple leaf nodes in the migration graph: (%s). To fix them run 'python makemigrations --merge'

I lead a project where we have frequent newcomers. on a few occasions they encountered this message and the reason was always that they rebased their feature branch on a new master, and the master brought a new migration which conflicted with a new migration in the feature branch.

we generally don't see why we would want the merge migrations and advise them to migrate to the common ancestor, rename their migration and change the dependency, and then run migrate again. that's easy enough and the end result is simpler.

i think makemigrations --merge matches well to a git workflow with merging. in our project, we use rebasing instead, and there the merge migrations don't make much sense.

I propose to change the message to To fix them by creating a merge migration, run 'python makemigrations --merge' to make it more clearer what will happen, and add Alternatively, you can resolve the conflict manually.

an automatic solution could look like this: mergemigrations --rebase <number_of_migration_to_rebase>, which would ask for confirmation this will rebase migration <name_of_migration_to_rebase> onto migration <name_of_new_base_migration>, or this will set <name_of_new_base_migration> as new dependency of <name_of_migration_to_rebase>.

Change History (7)

comment:1 Changed 22 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 21 months ago by Masashi SHIBATA

Owner: changed from nobody to Masashi SHIBATA
Status: newassigned

Hi! Now I'm implementing this feature at following branch:

I'll submit a PR after adding tests and refactoring.

Last edited 21 months ago by Masashi SHIBATA (previous) (diff)

comment:3 Changed 21 months ago by Masashi SHIBATA

comment:4 Changed 21 months ago by Masashi SHIBATA

Has patch: set

comment:5 Changed 17 months ago by karyon

*bump* this needs a review.

comment:6 Changed 17 months ago by Tim Graham

Bump isn't helpful. There are 52 patches needing review at this time. You're welcome to help. Use the PatchReviewChecklist and mark the ticket as "ready for checkin" if it looks okay.

comment:7 Changed 15 months ago by Carlton Gibson

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