mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
updates from previous PR changes
This commit is contained in:
parent
fdf580d9b5
commit
53a8b33cb7
@ -104,7 +104,7 @@ class MigrationTestBase(TransactionTestCase):
|
||||
.values()
|
||||
if (
|
||||
c["columns"] == list(columns)
|
||||
and (index_type is None or c["type"] == index_type)
|
||||
and (index_type is None or c.get("type") == index_type)
|
||||
and not c["unique"]
|
||||
)
|
||||
),
|
||||
|
@ -6235,11 +6235,12 @@ class PrimaryKeyOperations(OperationTestBase):
|
||||
"field2",
|
||||
models.SlugField(max_length=20, primary_key=True),
|
||||
)
|
||||
|
||||
project_state = ProjectState()
|
||||
new_state = project_state.clone()
|
||||
operation1.state_forwards("migrtest", new_state)
|
||||
|
||||
self.assertTableNotExists("migrtest_simplemodel")
|
||||
with connection.schema_editor() as editor:
|
||||
new_state = project_state.clone()
|
||||
operation1.state_forwards("migrtest", new_state)
|
||||
operation1.database_forwards("migrtest", editor, project_state, new_state)
|
||||
project_state, new_state = new_state, new_state.clone()
|
||||
operation2.state_forwards("migrtest", new_state)
|
||||
@ -6247,6 +6248,16 @@ class PrimaryKeyOperations(OperationTestBase):
|
||||
project_state, new_state = new_state, new_state.clone()
|
||||
operation3.state_forwards("migrtest", new_state)
|
||||
operation3.database_forwards("migrtest", editor, project_state, new_state)
|
||||
self.assertTableExists("migrtest_simplemodel")
|
||||
self.assertColumnExists("migrtest_simplemodel", "field1")
|
||||
self.assertColumnExists("migrtest_simplemodel", "field2")
|
||||
with connection.cursor() as cursor:
|
||||
primary_keys = connection.introspection.get_primary_key_columns(
|
||||
cursor, "migrtest_simplemodel"
|
||||
)
|
||||
self.assertEqual(["field2"], primary_keys)
|
||||
self.assertIndexExists("migrtest_simplemodel", ["field1"], index_type="idx")
|
||||
self.assertIndexExists("migrtest_simplemodel", ["field2"], index_type="idx")
|
||||
|
||||
|
||||
class SwappableOperationTests(OperationTestBase):
|
||||
|
Loading…
Reference in New Issue
Block a user