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

Refs #24686 -- Made AlterField operation a noop when renaming related model with db_table.

This commit is contained in:
devilsautumn
2023-07-18 00:31:38 +05:30
committed by Mariusz Felisiak
parent 07b7a3ab75
commit f05cc5e3d2
2 changed files with 22 additions and 0 deletions

View File

@@ -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"