#23226: Migrations generated by python2 break when using python3 to migrate
---------------------------------+----------------------
     Reporter:  morshed.nader@…  |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Migrations       |    Version:  1.7-rc-2
     Severity:  Release blocker  |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+----------------------
 It seems that the use of byte strings in the files generated by `python2
 manage.py makemigrations <module>` cause migrations to break when running
 `python3 manage.py migrate`. This seems to be caused by the use of byte
 strings in the model field names, as replacing all instances of `b''` with
 `''` fixes the issue.

 I have created a simple demo project that will cause an error to be throw
 during migrations. This includes migrations already generated by Python2 +
 Django-1.7rc2 + makemigrations:

 https://github.com/naderm/django-migrations-test

 Which throws the exception:

 {{{
 $ python3 manage.py migrate

 ...

 django.db.models.fields.FieldDoesNotExist: ModelTest has no field named
 b'season'

 $ python2 manage.py migrate
 Operations to perform:
   Apply all migrations: admin, contenttypes, migratemodule, auth, sessions
 Running migrations:
   Applying migratemodule.0001_initial... OK
   Applying sessions.0001_initial... OK
 }}}

 The case here uses a unique_together constraint that causes the exception
 to be thrown, but I have also seen the same error generated by the use of
 foreign keys and many to many relations.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23226>
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/066.eb15822e879ad79ff3b409d2fb236859%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to