﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25618	Django migration system breaks with unhelpful error message if south migrations accidentally retained	David Filipovic	nobody	"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."	Bug	closed	Migrations	1.7	Normal	fixed	migrations, south	django@…	Accepted	1	0	0	0	1	0
