#25698: App without migrations depending on app with migrations fails on initial
migrate call (postgres)
----------------------------------+--------------------------------------
Reporter: lucasmoeskops | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: migrate postgres | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by lucasmoeskops):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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.
>
> I guess the app should have at least one migration with a dependency to
> django.contrib.sites. But maybe this needs to be documented. I couldn't
> find it in the documentation.
New description:
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 with a
dependency to django.contrib.sites. But maybe this needs to be documented.
I couldn't find it in the documentation.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25698#comment:1>
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/071.5d9ebe2e8d6c0e992c79eed16ecf699c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.