#25922: migrate --run-syncdb with ManyToManyFields on 1.9
----------------------------+-----------------------------------------
     Reporter:  tkhyn       |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.9
     Severity:  Normal      |   Keywords:  migrate, syncdb, migrations
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+-----------------------------------------
 Hello,

 I've run into an issue with Django 1.9's new {{{migrate --run-syncdb}}}
 command, which is supposed to replace {{{syncdb}}}. It does not seem to be
 related to #25884.

 Basically, the workflow syncdb => makemigrations => migrate --fake-initial
 is broken when ManyToManyFields are used in models. Using any other field
 (even FKs) work fine.

 I found out that when running {{{migrate --fake-initial}}},
 {{{MigrationExecutor.detect_soft_applied}}} could not find a matching
 column for the M2M field in the existing table, and therefore considers
 that the initial migration has not been implicitly applied. My
 understanding is that {{{migrate --run-syncdb}}} failed to create that in
 the first place.

 I have set up a minimal project to expose the issue:

 - [https://bitbucket.org/tkhyn/dj19_run_syncdb/src/default not working
 with Django 1.9]
 - [https://bitbucket.org/tkhyn/dj19_run_syncdb/src/dj18 working like a
 charm with Django 1.8]

 My use case ? [https://bitbucket.org/tkhyn/django-gm2m django-gm2m]'s test
 suite needs to initialize individual apps one by one and sync the db
 before each TestCase (and then run migration tests from that state).

 Thanks in advance for looking into this, and thanks already for all the
 work put in Django so far!

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

Reply via email to