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.
* Attachment "django-south-bug-fix.diff" added.
* Attachment "django-south-bug-fix.diff" added.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
It's a bit late to add this (in particular, 1.7 is end-of-life Dec. 1 and
is only receiving security updates), but adding to 1.8/1.9 seems okay
since you offered a patch, so I converted it to a
[https://github.com/django/django/pull/5489 pull request]. For 1.10, I
proposed to [https://github.com/django/django/pull/5488 remove detection
of south migrations].
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:1>
Comment (by Tim Graham <timograham@…>):
In [changeset:"c4af8eb366be45420e13a400cc1dcc8fab91c1ad" c4af8eb]:
{{{
#!CommitTicketReference repository=""
revision="c4af8eb366be45420e13a400cc1dcc8fab91c1ad"
Refs #25618 -- Removed detection of south migrations in loader.
It doesn't seem relevant for anyone upgrading to Django 1.10
and beyond.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"65bff161ffab1310719bdee495d1e9b35f838c31" 65bff16]:
{{{
#!CommitTicketReference repository=""
revision="65bff161ffab1310719bdee495d1e9b35f838c31"
[1.8.x] Fixed #25618 -- Added a helpful error message when Django & south
migrations exist in the same directory.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:3>
Comment (by Tim Graham <timograham@…>):
In [changeset:"774a893d0bf3433571a94cd27883fab61010440a" 774a893]:
{{{
#!CommitTicketReference repository=""
revision="774a893d0bf3433571a94cd27883fab61010440a"
[1.9.x] Fixed #25618 -- Added a helpful error message when Django & south
migrations exist in the same directory.
Forwardport of 65bff161ffab1310719bdee495d1e9b35f838c31 from stable/1.8.x
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"e5ab75d2fda8ef2617bc13074206e66c980ca51f" e5ab75d2]:
{{{
#!CommitTicketReference repository=""
revision="e5ab75d2fda8ef2617bc13074206e66c980ca51f"
Refs #25618 -- Forwardported 1.8.6 release note.
Forwardport of 65bff161ffab1310719bdee495d1e9b35f838c31 from stable/1.8.x
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:5>
Comment (by Tim Graham <timograham@…>):
In [changeset:"9e7d0d90cc35800cd309d4e0296523220864e884" 9e7d0d9]:
{{{
#!CommitTicketReference repository=""
revision="9e7d0d90cc35800cd309d4e0296523220864e884"
[1.9.x] Fixed #25627, refs #25618 -- Removed detection of south migrations
in loader.
Backport of c4af8eb366be45420e13a400cc1dcc8fab91c1ad from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:6>
* status: closed => new
* resolution: fixed =>
Comment:
The "fix" breaks `django_extensions` and possibly a lot of other packages
that have support for pre django 1.7 versions.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:7>
Comment (by ryuusenshi):
The problem is actually in the fact that `django-extensions` is using the
`migrations` module to store south migrations and still claims to support
Django 1.4 and later. However, since 1.7 the `migrations` module was
reserved for Django migrations, and even the
[http://south.readthedocs.org/en/latest/releasenotes/1.0.html last
official release of South] instructs developers to move south migrations
to `south_migrations` module.
So, in conclusion, `django-extensions` never really fully supported Django
1.7+.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:8>
* Attachment "django_style_migrations_fix.diff" added.
Comment (by ryuusenshi):
I'm not even sure if this should really be fixed on django's side, but
I've created another
[https://code.djangoproject.com/attachment/ticket/25618/django_style_migrations_fix.diff
patch], just in case.
This patch would make it so that in the case such as `django-extensions`
where south `migrations` module was just left hanging around, against
instructions to be moved, Django would just ignore those migrations.
I will create a pull request later, and let the core developers decide
whether this should be addressed or not.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:9>
* cc: django@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:10>
Comment (by ryuusenshi):
@codingjoe, I've created a new [https://github.com/django/django/pull/5548
pull request] to address the problem you reported here.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:11>
Comment (by nimasmi):
FWIW django-extensions has fixed it internally (https://github.com/django-
extensions/django-
extensions/commit/dbabd69e48e682916e0ffdc7a3567f8fe148ddf3,
https://github.com/django-extensions/django-
extensions/blob/master/CHANGELOG.md#159), but I acknowledge that Django
should expect other third-party apps not to toe the line.
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:12>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"8c8a6d8a3f869ecc4d72b96ddb4760a1b59d5e62" 8c8a6d8a]:
{{{
#!CommitTicketReference repository=""
revision="8c8a6d8a3f869ecc4d72b96ddb4760a1b59d5e62"
[1.8.x] Fixed #25618 -- Restored migration support for non-upgraded apps.
A non-upgraded app is one that retains South migrations in the
`migrations` module and doesn't introduce Django migrations.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:13>
Comment (by Tim Graham <timograham@…>):
In [changeset:"dbbae2cead5ca1f15177415d4bfe795d4402be9f" dbbae2c]:
{{{
#!CommitTicketReference repository=""
revision="dbbae2cead5ca1f15177415d4bfe795d4402be9f"
Refs #25618 -- Forwardported 1.8.7 release note.
Forwardport of 8c8a6d8a3f869ecc4d72b96ddb4760a1b59d5e62 from stable/1.8.x
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:14>
Comment (by Tim Graham <timograham@…>):
In [changeset:"3dcdfcc8d359fa15f62c46e16875082c8a9c28ff" 3dcdfcc8]:
{{{
#!CommitTicketReference repository=""
revision="3dcdfcc8d359fa15f62c46e16875082c8a9c28ff"
[1.9.x] Refs #25618 -- Forwardported 1.8.7 release note.
Forwardport of 8c8a6d8a3f869ecc4d72b96ddb4760a1b59d5e62 from stable/1.8.x
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25618#comment:15>