From 4f3b81ba83bbb7cffc7a02a003c55948509b8645 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 5 Sep 2024 16:35:43 -0400 Subject: [PATCH 1/2] set DatabaseFeatures.allows_multiple_constraints_on_same_fields = False --- django_mongodb/features.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/django_mongodb/features.py b/django_mongodb/features.py index 6236ed770..9966ceb86 100644 --- a/django_mongodb/features.py +++ b/django_mongodb/features.py @@ -4,6 +4,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): allow_sliced_subqueries_with_in = False + allows_multiple_constraints_on_same_fields = False can_create_inline_fk = False can_introspect_foreign_keys = False greatest_least_ignores_nulls = True @@ -107,14 +108,11 @@ class DatabaseFeatures(BaseDatabaseFeatures): "schema.tests.SchemaTests.test_remove_constraints_capital_letters", "schema.tests.SchemaTests.test_remove_db_index_doesnt_remove_custom_indexes", # AlterField (unique) - "schema.tests.SchemaTests.test_remove_field_unique_does_not_remove_meta_constraints", "schema.tests.SchemaTests.test_unique", "schema.tests.SchemaTests.test_unique_and_reverse_m2m", # alter_index_together "schema.tests.SchemaTests.test_index_together", - "schema.tests.SchemaTests.test_remove_index_together_does_not_remove_meta_indexes", # alter_unique_together - "schema.tests.SchemaTests.test_remove_unique_together_does_not_remove_meta_constraints", "schema.tests.SchemaTests.test_unique_together", # add/remove_constraint "schema.tests.SchemaTests.test_composed_constraint_with_fk", From 9253a749d256b96484e8d46f16d91867f7106dc1 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 13 Sep 2024 13:32:55 -0400 Subject: [PATCH 2/2] add migrations.test_operations to CI --- .github/workflows/test-python.yml | 1 + django_mongodb/features.py | 40 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 93dd6b532..9f880850e 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -97,6 +97,7 @@ jobs: many_to_many many_to_one many_to_one_null + migrations.test_operations model_fields model_forms mutually_referential diff --git a/django_mongodb/features.py b/django_mongodb/features.py index 9966ceb86..e0f80b400 100644 --- a/django_mongodb/features.py +++ b/django_mongodb/features.py @@ -14,6 +14,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_column_check_constraints = False supports_date_lookup_using_string = False supports_explaining_query_execution = True + supports_expression_defaults = False supports_expression_indexes = False supports_foreign_keys = False supports_ignore_conflicts = False @@ -84,6 +85,12 @@ class DatabaseFeatures(BaseDatabaseFeatures): "backends.tests.ThreadTests.test_closing_non_shared_connections", "backends.tests.ThreadTests.test_default_connection_thread_local", # Add/RemoveIndex + "migrations.test_operations.OperationTests.test_add_index", + "migrations.test_operations.OperationTests.test_alter_field_with_index", + "migrations.test_operations.OperationTests.test_remove_index", + "migrations.test_operations.OperationTests.test_rename_index", + "migrations.test_operations.OperationTests.test_rename_index_unknown_unnamed_index", + "migrations.test_operations.OperationTests.test_rename_index_unnamed_index", "schema.tests.SchemaTests.test_add_remove_index", "schema.tests.SchemaTests.test_composed_desc_index_with_fk", "schema.tests.SchemaTests.test_composed_index_with_fk", @@ -111,13 +118,26 @@ class DatabaseFeatures(BaseDatabaseFeatures): "schema.tests.SchemaTests.test_unique", "schema.tests.SchemaTests.test_unique_and_reverse_m2m", # alter_index_together + "migrations.test_operations.OperationTests.test_alter_index_together", "schema.tests.SchemaTests.test_index_together", # alter_unique_together + "migrations.test_operations.OperationTests.test_alter_unique_together", "schema.tests.SchemaTests.test_unique_together", # add/remove_constraint + "introspection.tests.IntrospectionTests.test_get_constraints", + "migrations.test_operations.OperationTests.test_add_partial_unique_constraint", + "migrations.test_operations.OperationTests.test_create_model_with_partial_unique_constraint", + "migrations.test_operations.OperationTests.test_remove_partial_unique_constraint", "schema.tests.SchemaTests.test_composed_constraint_with_fk", "schema.tests.SchemaTests.test_remove_ignored_unique_constraint_not_create_fk_index", "schema.tests.SchemaTests.test_unique_constraint", + # pymongo.errors.OperationFailure: Can't rename a collection to itself + "migrations.test_operations.OperationTests.test_alter_model_table_noop", + "migrations.test_operations.OperationTests.test_rename_model_no_relations_with_db_table_noop", + "migrations.test_operations.OperationTests.test_rename_model_with_db_table_rename_m2m", + # subclasses of BaseDatabaseIntrospection may require a get_constraints() method + "migrations.test_operations.OperationTests.test_add_func_unique_constraint", + "migrations.test_operations.OperationTests.test_remove_func_unique_constraint", } # $bitAnd, #bitOr, and $bitXor are new in MongoDB 6.3. _django_test_expected_failures_bitwise = { @@ -142,6 +162,14 @@ def django_test_expected_failures(self): # bson.errors.InvalidDocument: cannot encode object: #