#30467: `makemigrations app_label` sometimes tries to create migrations for
unrequested app_label
-------------------------------------+-------------------------------------
Reporter: Vsevolod Novikov | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Migrations | Version: 2.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vsevolod Novikov):
* status: closed => new
* resolution: invalid =>
Comment:
Replying to [comment:1 Carlton Gibson]:
> Given the `ForeignKey`, this is expected behaviour, as explained in the
[https://docs.djangoproject.com/en/2.2/topics/migrations/#dependencies
Dependencies section of the Migrations documentation], and linked to from
the `makemigrations` docs.
>
> > While migrations are per-app, the tables and relationships implied by
your models are too complex to be created for just one app at a time. When
you make a migration that requires something else to run - for example,
you add a ForeignKey in your books app to your authors app - the resulting
migration will contain a dependency on a migration in authors.
This explanation doesn't contain any description of what happens. It just
describes that the **dependency section** itself should contain references
to another app migrations, but there is nothing about automatic creation
of new **migration** in another application.
Existence of the table referred in the `ForeignKey` field (what's the
documentation about really IMHO) is provided by the existent `app1`
migrations, so there is enough to have a reference to the last existent
migration in the `app1` instead of newly created, as it happens if no
uncovered changes in the referred model are found:
{{{
#!python
...
dependencies = [
('app1', '0001_initial'),
]
...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30467#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.5e7c39d83368928b0e10857f128a4715%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.