[1.7.x] Fixed #23008 -- Fixed typo causing bad migration dependencies.
Thanks semenov for the report and Florian for investigation.
Backport of 9a2ab62977
from master
This commit is contained in:
parent
f2011e21a2
commit
fe5f29eb1d
|
@ -254,13 +254,13 @@ class MigrationAutodetector(object):
|
||||||
# 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:
|
||||||
|
|
|
@ -1045,4 +1045,4 @@ class AutodetectorTests(TestCase):
|
||||||
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__")])
|
||||||
|
|
Loading…
Reference in New Issue