#23459: not faking 0001_initial migration
----------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
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 brian):
I kind of feel like a dope. I made the change to the db model, but
completely forgot to regenerate the migration.
Anyway, to debug this type of issue, see django/db/migrations/executor.py,
in particular the detect_soft_applied function. This function returns True
if the migration is already applied and should be skipped.
In my case, it was returning false because it could not find one of the
tables. If I understand the code correctly, if one of the tables is
missing it will try to run the entire migration. Maybe it should really
error out if at least one of the tables exists but not all of them do?
Anyway, this is the code that was returning False for me.
{{{
if model._meta.db_table not in
self.connection.introspection.get_table_list(self.connection.cursor()):
return False
}}}
I believe I have solved this issue now (I still need to double check this,
but my tests are now failing for unrelated reasons) so I don't particular
care what happens with this ticket, however I think this is a problem
others are likely to encounter, so recommend Django do something to try
and make it more obvious what is going on.
--
Ticket URL: <https://code.djangoproject.com/ticket/23459#comment:4>
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/063.6ef5f3fcb2029345bd666ca353157159%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.