From 3b9602eae7f083bca9ba625d11f53051efdcd1e9 Mon Sep 17 00:00:00 2001 From: Jerome Leclanche Date: Sun, 11 Dec 2022 17:04:29 +0100 Subject: [PATCH] Fix backwards migration not running after refactor --- postgres_composite_types/operations.py | 4 +++- tests/test_field.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/postgres_composite_types/operations.py b/postgres_composite_types/operations.py index 13b3688..5de9590 100644 --- a/postgres_composite_types/operations.py +++ b/postgres_composite_types/operations.py @@ -47,4 +47,6 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state): ) def database_backwards(self, app_label, schema_editor, from_state, to_state): - return sql_drop_type(self.Meta.db_type, schema_editor=schema_editor) + schema_editor.execute( + sql_drop_type(self.Meta.db_type, schema_editor=schema_editor) + ) diff --git a/tests/test_field.py b/tests/test_field.py index e3045df..4ee6033 100644 --- a/tests/test_field.py +++ b/tests/test_field.py @@ -84,6 +84,7 @@ def test_migration(self): # Run the migration forwards to create the type again migrate(self.migrate_to) + self.assertTrue(does_type_exist(SimpleType._meta.db_type)) # The signal should have been sent self.assertEqual(signal_func.call_count, 1)