1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.7.x] Fixed #23071 -- Use last migration's name in dependency to other app

Changed the autodetector to lookup the name of the other app's last
migration in the graph and use that as dependency instead of using
__latest__.
This commit is contained in:
Jeroen Dekkers
2014-07-14 21:09:33 +02:00
committed by Andrew Godwin
parent d8961a5ad0
commit 6e7e5bacd5
9 changed files with 9 additions and 65 deletions

View File

@@ -1057,7 +1057,8 @@ class AutodetectorTests(TestCase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_last_dependency(self):
"""
Tests that a dependency to an app with existing migrations uses __latest__.
Tests that a dependency to an app with existing migrations uses the
last migration of that app.
"""
# Load graph
loader = MigrationLoader(connection)
@@ -1072,4 +1073,4 @@ class AutodetectorTests(TestCase):
self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"])
self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book")
# Right dependencies?
self.assertEqual(changes['otherapp'][0].dependencies, [("migrations", "__latest__")])
self.assertEqual(changes['otherapp'][0].dependencies, [("migrations", "0002_second")])