#25698 closed Uncategorized (invalid)
App without migrations depending on app with migrations fails on initial migrate call (postgres)
Reported by: | Lucas Moeskops | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.8 |
Severity: | Normal | Keywords: | migrate postgres |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Simple test example:
In a new project add 'django.contrib.sites' and your main app to the INSTALLED APPS
setting.
Use postgres as database.
Make a model in your main app that uses a relation to django.contrib.sites:
from django.contrib.sites.models import Site class MyModel(models.Model): my_site = models.ForeignKey(Site)
Migrate the project:
python manage.py migrate
It will fail to migrate with the message: django.db.utils.ProgrammingError: relation "django_site" does not exist
. This is because it tries to migrate the apps without migrations before the apps with migrations.
To solve the problem, the app should have at least one migration. But maybe this needs to be documented. I couldn't find it in the documentation.
Change History (5)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|
comment:3 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:4 by , 9 years ago
Also, it seems to be fixed in django master :-) It will execute the queries in the correct order.
comment:5 by , 9 years ago
I think improving the error message (about missing migrations) is tracked in #24484.
This is a documented limitation.