diff options
| author | Tim Graham <timograham@gmail.com> | 2014-09-24 15:49:30 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-09-24 15:49:30 -0400 |
| commit | d7ab2cefb7ec94bf45d37a02c79b6703ea2880e5 (patch) | |
| tree | 3128fcc9944c6c82360c66efb25f5e57c8ea7c3f /django | |
| parent | a4f23eba2e690f1331fe35d6f29af42899e80395 (diff) | |
Revert "Fixed #23474 -- Prevented migrating backwards from unapplying the wrong migrations."
This reverts commit abcf28a07695a45cb5fb15b81bffc97bea5e0be3.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/executor.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py index 6ebb21fc0b..32aa82b82c 100644 --- a/django/db/migrations/executor.py +++ b/django/db/migrations/executor.py @@ -36,15 +36,11 @@ class MigrationExecutor(object): # If the migration is already applied, do backwards mode, # otherwise do forwards mode. elif target in applied: - app_label = target[0] - next_migration_prefix = str(int(target[1][:4]) + 1) - try: - next_migration = self.loader.get_migration_by_prefix(app_label, next_migration_prefix) - except KeyError: - # If `target` is the most recent one in its app, there is nothing to do. - pass - else: - backwards_plan = self.loader.graph.backwards_plan(next_migration) + backwards_plan = self.loader.graph.backwards_plan(target)[:-1] + # We only do this if the migration is not the most recent one + # in its app - that is, another migration with the same app + # label is in the backwards plan + if any(node[0] == target[0] for node in backwards_plan): for migration in backwards_plan: if migration in applied: plan.append((self.loader.graph.nodes[migration], True)) |
