#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 | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by maciej-pawlisz):
It was Django 1.9. From what I see when `initial` is `True`, django
proceeds to checking db schema and this check fails. Actually it fails
with every `ManyToManyField`, because it is added in `AddField` operation,
but is not present in database schema:
djang.db.migrations.executor.py:291
{{{
db_field = model._meta.get_field(operation.name).column
fields =
self.connection.introspection.get_table_description(self.connection.cursor(),
table)
if db_field not in (f.name for f in fields):
return False, project_state
}}}
Easy fix would be adding this line before that check:
{{{
if isinstance(operation.field,models.ManyToMany):
continue
}}}
But maybe the bug is somewhere else ie. why
`model._meta.get_field(operation.name).column` is not None for
ManyToManyField ?
--
Ticket URL: <https://code.djangoproject.com/ticket/25904#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 [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/072.7021fa535adb01a84b1b0058d16b6d53%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.