Opened 10 years ago
Closed 10 years ago
#24755 closed Bug (fixed)
makemigrations --merge output is confusing when one head depends on another app
| Reported by: | Carl Meyer | Owned by: | Markus Holtermann |
|---|---|---|---|
| Component: | Migrations | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | 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
When you run makemigrations --merge, for every app with multiple 'head' migrations, makemigrations lists each head and the operations present only in its branch. So for instance, if we have an app X which has migrations X.0003_a and X.0003_b, both of which depend on X.0002, then makemigrations --merge will list the operations present in each of the two migrations X.0003_a and X.0003_b so we can verify that they don't conflict. So far, so good.
However, let's say we have another app Y, with migrations up to Y.0004, and it so happens that X.0003_b depends on Y.0004 (in addition to depending on X.0002).
In this situation, makemigrations --merge includes every operation in every migration of app Y in its list of operations that are part of the X.0003_b branch. This is very confusing, as it makes that branch appear much bigger than it actually is. Despite the dependency, the migrations in app Y are not relevant to determining whether the merge is safe, because in general it is an assumption of the migrations framework that migrations in different apps do not conflict with one another (which is we allow one "head" migration per app, not per project).
I think that makemigrations --merge should restrict its search for operations in each branch to the current app only, and not display operations from a different app.
Change History (5)
comment:1 by , 10 years ago
| Summary: | makemigrations --merge output is confusing when one head has a dependency to another app → makemigrations --merge output is confusing when one head depends on another app |
|---|
comment:2 by , 10 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 10 years ago
| Has patch: | set |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:4 by , 10 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR: https://github.com/django/django/pull/5121