#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
----------------------------------+--------------------------------------
Description changed by lucasmoeskops:

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.
>
> 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.

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. But
 maybe this needs to be documented. I couldn't find it in the
 documentation.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25698#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.f62c5deeed8464a27d8bde94a04943d0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to