Skip to content

Commit

Permalink
Fixed #23008 -- Fixed typo causing bad migration dependencies.
Browse files Browse the repository at this point in the history
Thanks semenov for the report and Florian for investigation.
  • Loading branch information
timgraham committed Jul 15, 2014
1 parent 671e0c9 commit 9a2ab62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions django/db/migrations/autodetector.py
Expand Up @@ -254,13 +254,13 @@ def _detect_changes(self, convert_apps=None, graph=None):
# If we can't find the other app, we add a first/last dependency, # If we can't find the other app, we add a first/last dependency,
# but only if we've already been through once and checked everything # but only if we've already been through once and checked everything
if chop_mode: if chop_mode:
# If the app already exists, we add __last__, as we don't know which # If the app already exists, we add __latest__, as we don't know which
# migration contains the target field. # migration contains the target field.
# If it's not yet migrated or has no migrations, we use __first__ # If it's not yet migrated or has no migrations, we use __first__
if graph and not graph.root_nodes(dep[0]): if graph and not graph.root_nodes(dep[0]):
operation_dependencies.add((dep[0], "__first__")) operation_dependencies.add((dep[0], "__first__"))
else: else:
operation_dependencies.add((dep[0], "__last__")) operation_dependencies.add((dep[0], "__latest__"))
else: else:
deps_satisfied = False deps_satisfied = False
if deps_satisfied: if deps_satisfied:
Expand Down
2 changes: 1 addition & 1 deletion tests/migrations/test_autodetector.py
Expand Up @@ -1057,4 +1057,4 @@ def test_last_dependency(self):
self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"])
self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book") self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book")
# Right dependencies? # Right dependencies?
self.assertEqual(changes['otherapp'][0].dependencies, [("migrations", "__last__")]) self.assertEqual(changes['otherapp'][0].dependencies, [("migrations", "__latest__")])

0 comments on commit 9a2ab62

Please sign in to comment.