mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #27768 -- Allowed migration optimization of CreateModel order.
Thanks Ed Morley from Mozilla for the tests.
This commit is contained in:
committed by
Tim Graham
parent
d3a935f01f
commit
a97845a823
@@ -1150,10 +1150,9 @@ class AutodetectorTests(TestCase):
|
||||
changes = self.get_changes([], [self.author_with_publisher, self.publisher])
|
||||
# Right number/type of migrations?
|
||||
self.assertNumberMigrations(changes, 'testapp', 1)
|
||||
self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel", "AddField"])
|
||||
self.assertOperationAttributes(changes, "testapp", 0, 0, name="Author")
|
||||
self.assertOperationAttributes(changes, "testapp", 0, 1, name="Publisher")
|
||||
self.assertOperationAttributes(changes, "testapp", 0, 2, name="publisher")
|
||||
self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel"])
|
||||
self.assertOperationAttributes(changes, "testapp", 0, 0, name="Publisher")
|
||||
self.assertOperationAttributes(changes, "testapp", 0, 1, name="Author")
|
||||
self.assertMigrationDependencies(changes, 'testapp', 0, [])
|
||||
|
||||
def test_circular_fk_dependency(self):
|
||||
@@ -1907,13 +1906,12 @@ class AutodetectorTests(TestCase):
|
||||
# Right number/type of migrations?
|
||||
self.assertNumberMigrations(changes, "testapp", 1)
|
||||
self.assertOperationTypes(changes, "testapp", 0, [
|
||||
"CreateModel", "CreateModel", "CreateModel", "AddField", "AddField"
|
||||
'CreateModel', 'CreateModel', 'CreateModel', 'AddField',
|
||||
])
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author")
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Contract")
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 2, name="Publisher")
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 3, model_name='contract', name='publisher')
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 4, model_name='author', name='publishers')
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 0, name='Author')
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 1, name='Publisher')
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 2, name='Contract')
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 3, model_name='author', name='publishers')
|
||||
|
||||
def test_many_to_many_removed_before_through_model(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user