#25904: --fake-initial does not work for ManyToMany with through Model
--------------------------------+--------------------
Reporter: maciej-pawlisz | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------
I came across this issue when migrating from django 1.6.11 and south. When
model has ManyToMany field then automatic initial migration contains
`AddField` operation for this field, which of course is not present in
database, so django thinks that it cannot fake this migration.
How to reproduce:
`fake_through.models.py`:
{{{
from django.db import models
class A(models.Model):
b = models.ManyToManyField('B', through="C")
class B(models.Model):
pass
class C(models.Model):
a = models.ForeignKey('A')
b = models.ForeignKey('B')
}}}
commands:
{{{
python manage.py makemigrations fake_through
python manage.py migrate fake_through
python manage.py migrate fake_through zero --fake
python manage.py migrate fake_through --fake-initial
django.db.utils.OperationalError: table "fake_through_a" already exists
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25904>
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/057.c940e0cf45ffb6c6cefa5af5afaa05f3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.