#25618: Django migration system breaks with unhelpful error message if south
migrations accidentally retained
----------------------------+-------------------------------
Reporter: ryuusenshi | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: migrations, south
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
----------------------------+-------------------------------
For an app that contains both django and south type migrations, the
migration system will become unable to perform any migration task for that
app, and the error message will not be helpful at all (either "Application
labels aren't unique, duplicates: x" - django 1.7, or "table x already
exists" - django 1.8). This happens because the app is treated as both
migrated and unmigrated at the same time.
To reproduce this error, you can clone the repo:
[https://github.com/ryuusenshi/django-south-migrate-bugfix django-south-
bug]. This repo contains a migrations directory with 2 south type
migration in it.
Now run:
{{{
python manage.py makemigrations djsouth
}}}
followed by:
{{{
python manage.py migrate
}}}
What is of particular interest here is that the makemigrations command
created the initial django migration without deleting the other numbered
(south) migrations, thus putting the app into an erroneous state.
Additionally, it is worth noting that in this workflow, step 3 from
[https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-
south upgrading-from-south] was skipped, so essentially it is user error,
however I believe that the error message should not be entirely unhelpful.
The patch attached can be applied to both django 1.7 and 1.8, since they
are both affected by this. The patch will break the execution of the
migration system at the graph construction phase and report with a helpful
error message.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618>
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/053.b9fd554fe5206fa337800b772c1cae7e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.