1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #33201 -- Avoided unnecessary queries when renaming models with db_table on SpatiaLite.

This commit is contained in:
Mariusz Felisiak
2023-07-18 14:08:47 +02:00
committed by GitHub
parent 6ad2738a8f
commit 3109038992
2 changed files with 14 additions and 0 deletions

View File

@@ -988,6 +988,15 @@ class OperationTests(OperationTestBase):
"test_rmwsc_rider", ["pony_id"], ("test_rmwsc_littlehorse", "id")
)
def test_rename_model_no_relations_with_db_table_noop(self):
app_label = "test_rmwdbtnoop"
project_state = self.set_up_test_model(app_label, db_table="my_pony")
operation = migrations.RenameModel("Pony", "LittleHorse")
new_state = project_state.clone()
operation.state_forwards(app_label, new_state)
with connection.schema_editor() as editor, self.assertNumQueries(0):
operation.database_forwards(app_label, editor, project_state, new_state)
def test_rename_model_with_self_referential_m2m(self):
app_label = "test_rename_model_with_self_referential_m2m"