mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Merge pull request #2938 from dekkers/ticket_23071
Fixed #23071 -- Use last migration's name in dependency to other app
This commit is contained in:
commit
ed4812692e
9 changed files with 9 additions and 65 deletions
|
@ -1069,7 +1069,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)
|
||||
|
@ -1084,4 +1085,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")])
|
||||
|
|
|
@ -122,26 +122,6 @@ class LoaderTests(TestCase):
|
|||
],
|
||||
)
|
||||
|
||||
@modify_settings(INSTALLED_APPS={'append': 'basic'})
|
||||
@override_settings(MIGRATION_MODULES={
|
||||
"migrations": "migrations.test_migrations_latest",
|
||||
"basic": "migrations.test_migrations_latest_basic",
|
||||
})
|
||||
def test_latest(self):
|
||||
"""
|
||||
Makes sure that __latest__ works correctly.
|
||||
"""
|
||||
# Load and test the plan
|
||||
migration_loader = MigrationLoader(connection)
|
||||
self.assertEqual(
|
||||
migration_loader.graph.forwards_plan(("migrations", "0001_initial")),
|
||||
[
|
||||
("basic", "0001_initial"),
|
||||
("basic", "0002_second"),
|
||||
("migrations", "0001_initial"),
|
||||
],
|
||||
)
|
||||
|
||||
@override_settings(MIGRATION_MODULES={
|
||||
"migrations": "migrations.test_migrations_first",
|
||||
"migrations2": "migrations2.test_migrations_2_first",
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("basic", "__latest__"),
|
||||
]
|
||||
|
||||
operations = []
|
|
@ -1,11 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = []
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("basic", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = []
|
Loading…
Add table
Add a link
Reference in a new issue