summaryrefslogtreecommitdiff
path: root/tests/migrations
diff options
context:
space:
mode:
authorpetr.prikryl <petr.prikryl@olc.cz>2024-05-29 11:22:32 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-03-09 11:50:17 +0100
commit2a5aca38bbb37f6e7590ac6e68912bfbefb17dae (patch)
tree90a43c8c894cd622b8ddbf4c3ac1f49db997b465 /tests/migrations
parentde1117ea8eabe0ee0aa048e5a4e249eab7c4245e (diff)
Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Adam Johnson <me@adamj.eu> Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'tests/migrations')
-rw-r--r--tests/migrations/test_operations.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index e92b1c4506..1a268a8d86 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -2055,8 +2055,13 @@ class OperationTests(OperationTestBase):
self.assertEqual(len(new_state.models["test_rmfl", "pony"].fields), 4)
# Test the database alteration
self.assertColumnExists("test_rmfl_pony", "pink")
- with connection.schema_editor() as editor:
+ with (
+ connection.schema_editor() as editor,
+ CaptureQueriesContext(connection) as ctx,
+ ):
operation.database_forwards("test_rmfl", editor, project_state, new_state)
+ self.assertGreater(len(ctx.captured_queries), 0)
+ self.assertNotIn("CASCADE", ctx.captured_queries[-1]["sql"])
self.assertColumnNotExists("test_rmfl_pony", "pink")
# And test reversal
with connection.schema_editor() as editor: