summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordevilsautumn <bhuvnesh875@gmail.com>2023-07-18 00:31:38 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-07-22 20:13:42 +0200
commitf05cc5e3d2ae7663dbd248029bcb74500cf1029f (patch)
treea3d736b8e8f576542e1b36a820f50af39282725d /tests
parent07b7a3ab7573a0685975602c437ce4795a8885e7 (diff)
Refs #24686 -- Made AlterField operation a noop when renaming related model with db_table.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_operations.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index a8fcb057ce..58213ff642 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -997,6 +997,18 @@ class OperationTests(OperationTestBase):
with connection.schema_editor() as editor, self.assertNumQueries(0):
operation.database_forwards(app_label, editor, project_state, new_state)
+ @skipUnlessDBFeature("supports_foreign_keys")
+ def test_rename_model_with_db_table_and_fk_noop(self):
+ app_label = "test_rmwdbtfk"
+ project_state = self.set_up_test_model(
+ app_label, db_table="my_pony", related_model=True
+ )
+ new_state = project_state.clone()
+ operation = migrations.RenameModel("Pony", "LittleHorse")
+ 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"