#24524: Automatic migrations prevent creation of initial database table layout
-------------------------------------+-------------------------------------
     Reporter:  SimonSteinberger     |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  1.8rc1
     Severity:  Normal               |               Resolution:
                                     |  worksforme
     Keywords:  migrations, fail,    |             Triage Stage:
  collision                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jbrendel):

 Hello charettes,

 I tried to find you on the Django IRC channel,  but it looks like we keep
 missing each other there.

 I use version 0.7.28 of `social_auth`. And, yes, it does come with
 migrations. I confirmed that they were installed by pip. However, those
 seems to be migrations of the wrong kind (south?), so they are not
 recognized.

 Your comments, however, allows me to narrow my search, so I was finally
 able to find a solution that someone had posted on StackOverflow:
 [http://stackoverflow.com/a/33562236]

 In short: Find the original migrations that django-social-auth came with.
 Delete them. Then run `python manage.py makemigrations social_auth`. This
 will replace the original migrations with 'the right kind' of migrations.
 When you then run `python manage.py migrate` everything works as
 advertised.

 So, I guess the real problem is that django-social-auth does not yet come
 by default with the correct kind of migrations, which could be used by
 Django 1.8 and up.

 A secondary problem, however, is that Django (when you run migrate) does
 not provide any illuminating warnings. I'm wondering whether it could
 include a check for old-style migrations, so that it can print a helpful
 error message?

 Interestingly, you can do `python manage.py makemigrations social_auth`
 right after the `pip install...` and it will create a `0001_initial`
 migration, effectively overwriting the old `0001_initial` migration that
 `django-social-auth` came with. Unfortunately, there is a second migration
 (`0002_...`), which is also an old-style south migration. It remains in
 place and untouched by `makemigrations`. So, when I then do `python
 manage.py migrate` Django still complains with
 `django.db.migrations.loader.BadMigrationError: Migrated app 'social_auth'
 contains South migrations. Make sure all numbered South migrations are
 deleted prior to creating Django migrations.`

 That's why the contents of the migration directory that comes with
 `django-social-auth` needs to be deleted at first.

 I'm lucky, because I don't need to actually migrate old databases, I can
 start from scratch, but I could imagine that this could cause some issues
 for people that do need to migrate actual databases.

--
Ticket URL: <https://code.djangoproject.com/ticket/24524#comment:20>
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/074.c890d556f70bf9e8e278a8e17e2bd659%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to