#23618: Migrations only work for apps containing models
--------------------------------------+--------------------
Reporter: seddonym | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
Migrations only work for apps containing a `models.py`. This means that
if you create a data migration (`./manage.py makemigrations --empty
<app>`) for an app without a `models.py`, it will fail to execute when
running `./manage.py migrate`.
I think it would be better if apps containing migrations would run,
regardless of having that empty file.
This is because it can be a nice structure to have a 'main' app
responsible for general project-wide stuff, which includes running data
migrations that aren't directly related to models. An example might be
assigning some permissions in the database to a particular role, but for a
third party app.
Not sure if this is the only place where the check is made, but
`django.db.migrations.loader.MigrationLoader.load_disk()` uses the
following test to see whether to include the app:
{{{
if app_config.models_module is None:
continue
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23618>
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/051.1d4525884fa0bdce16fa246762421bf3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.