summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-08-29 10:07:53 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-08-29 10:08:26 +0200
commit524ea6b77b9bcc8cb24fd0b55e5cb8ca4186ee4f (patch)
treeeca2ff14b83bd64a4e8eaaab97a1cfaf3b6d58c3
parente98869a8a86e92982f8172418b5d79472ba18cfe (diff)
[4.1.x] Refs #33953 -- Fixed test_rename_model_with_db_table_rename_m2m() crash on SQLite < 3.20.
Backport of a9e7beb959bc726eab1c192d2625d6ff6cfa70f4 from main
-rw-r--r--tests/migrations/test_operations.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 1709377dbc..6a286cb97c 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -1074,12 +1074,12 @@ class OperationTests(OperationTestBase):
),
],
)
- new_state = project_state.clone()
- operation = migrations.RenameModel("Pony", "PinkPony")
- operation.state_forwards(app_label, new_state)
- with connection.schema_editor() as editor:
- operation.database_forwards(app_label, editor, project_state, new_state)
-
+ new_state = self.apply_operations(
+ app_label,
+ project_state,
+ operations=[migrations.RenameModel("Pony", "PinkPony")],
+ atomic=connection.features.supports_atomic_references_rename,
+ )
Pony = new_state.apps.get_model(app_label, "PinkPony")
Rider = new_state.apps.get_model(app_label, "Rider")
pony = Pony.objects.create()