From 3dbfca90b237550354bd8ce109d33caebc9beca0 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 30 Aug 2024 10:54:46 -0400 Subject: [PATCH 1/3] drop support for CockroachDB 23.1 --- .github/workflows/tests.yml | 5 ----- README.md | 4 ---- django_cockroachdb/features.py | 28 +--------------------------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 32db06e..007620d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,11 +29,6 @@ jobs: fail-fast: false matrix: include: - - crdb-version: v23.1.27 - - crdb-version: v23.1.27 - use_psycopg2: psycopg2 - - crdb-version: v23.1.27 - use_server_side_binding: server_side_binding - crdb-version: v23.2.12 - crdb-version: v23.2.12 use_psycopg2: psycopg2 diff --git a/README.md b/README.md index a3379ea..ca8bcc9 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,3 @@ using back to Cockroach Labs. To disable this, set - [overlaps_left (&<), overlaps_right (&>), overlaps_above (&<|), overlaps_below (&>|)](https://github.com/cockroachdb/cockroach/issues/57098) - [strictly_above (|>>), strictly_below (<<|)](https://github.com/cockroachdb/cockroach/issues/57095) - - ## Known issues and limitations in CockroachDB 23.1.x and earlier - -- CockroachDB doesn't support by ordering by JSON. diff --git a/django_cockroachdb/features.py b/django_cockroachdb/features.py index 6ebd8f9..bdd5b95 100644 --- a/django_cockroachdb/features.py +++ b/django_cockroachdb/features.py @@ -5,7 +5,7 @@ class DatabaseFeatures(PostgresDatabaseFeatures): - minimum_database_version = (23, 1) + minimum_database_version = (23, 2) # Cloning databases doesn't speed up tests. # https://github.com/cockroachdb/django-cockroachdb/issues/206 @@ -75,10 +75,6 @@ def introspected_field_types(self): 'virtual': None, } - @cached_property - def is_cockroachdb_23_2(self): - return self.connection.cockroachdb_version >= (23, 2) - @cached_property def is_cockroachdb_24_1(self): return self.connection.cockroachdb_version >= (24, 1) @@ -187,28 +183,6 @@ def django_test_expected_failures(self): # unknown signature: concat(varchar, int) (returning ) 'migrations.test_operations.OperationTests.test_add_generate_field', }) - if not self.is_cockroachdb_23_2: - expected_failures.update({ - # cannot index a json element: - # https://github.com/cockroachdb/cockroach/issues/35706 - 'schema.tests.SchemaTests.test_func_index_json_key_transform', - # ordering by JSON isn't supported: - # https://github.com/cockroachdb/cockroach/issues/35706 - 'db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_key', - 'db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_nested_key', - 'expressions_window.tests.WindowFunctionTests.test_key_transform', - 'model_fields.test_jsonfield.TestQuerying.test_deep_distinct', - 'model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder', - 'model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform', - 'model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform', - # unsupported comparison operator: > : - # https://github.com/cockroachdb/cockroach/issues/49144 - 'model_fields.test_jsonfield.TestQuerying.test_deep_lookup_transform', - # DataError: incompatible COALESCE expressions: expected pi() to be - # of type decimal, found type float - # https://github.com/cockroachdb/cockroach/issues/73587#issuecomment-988408190 - 'aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database', - }) if self.is_cockroachdb_24_1: # USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229 expected_failures.update({ From 5a2d5f2d324d73ae7996a56f37a4b883db9af18b Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 26 Oct 2024 17:02:12 -0400 Subject: [PATCH 2/3] update for Django 5.2 --- CHANGELOG.md | 8 ++------ README.md | 4 ++-- django-test-suite/build.sh | 2 +- django_cockroachdb/__init__.py | 2 +- django_cockroachdb/features.py | 3 ++- django_cockroachdb_gis/features.py | 1 + django_cockroachdb_gis/schema.py | 2 +- setup.cfg | 4 ++-- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d28b9a7..d65ebee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -## 5.1.1 - Unreleased +## 5.2 - Unreleased -- Confirmed support for CockroachDB 24.2.x (no code changes required). - -## 5.1 - 2024-08-13 - -Initial release for Django 5.1.x and CockroachDB 23.1.x, 23.2.x, and 24.1.x. +Initial release for Django 5.2.x and CockroachDB 23.2.x, 24.1.x, and 24.2.x. diff --git a/README.md b/README.md index ca8bcc9..c888f75 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ production it is advised to use the package built from sources. ## Install and usage Use the version of django-cockroachdb that corresponds to your version of -Django. For example, to get the latest compatible release for Django 5.1.x: +Django. For example, to get the latest compatible release for Django 5.2.x: -`pip install django-cockroachdb==5.1.*` +`pip install django-cockroachdb==5.2.*` The minor release number of Django doesn't correspond to the minor release number of django-cockroachdb. Use the latest minor release of each. diff --git a/django-test-suite/build.sh b/django-test-suite/build.sh index b62d91c..08cff7a 100755 --- a/django-test-suite/build.sh +++ b/django-test-suite/build.sh @@ -7,7 +7,7 @@ VERSION=$1 # clone django into the repo. rm -rf _django_repo -git clone --depth 1 --single-branch --branch cockroach-5.1.x https://github.com/timgraham/django _django_repo +git clone --depth 1 --single-branch --branch cockroach-5.2.x https://github.com/timgraham/django _django_repo # install the django requirements. cd _django_repo/tests/ diff --git a/django_cockroachdb/__init__.py b/django_cockroachdb/__init__.py index 1af3e3f..b065149 100644 --- a/django_cockroachdb/__init__.py +++ b/django_cockroachdb/__init__.py @@ -1,4 +1,4 @@ -__version__ = '5.1' +__version__ = '5.2a0' # Check Django compatibility before other imports which may fail if the # wrong version of Django is installed. diff --git a/django_cockroachdb/features.py b/django_cockroachdb/features.py index bdd5b95..af5d7a2 100644 --- a/django_cockroachdb/features.py +++ b/django_cockroachdb/features.py @@ -161,6 +161,7 @@ def django_test_expected_failures(self): 'many_to_one.tests.ManyToOneTests.test_get_prefetch_querysets_reverse_invalid_querysets_length', 'migrations.test_operations.OperationTests.test_smallfield_autofield_foreignfield_growth', 'migrations.test_operations.OperationTests.test_smallfield_bigautofield_foreignfield_growth', + 'schema.tests.SchemaTests.test_alter_smallint_pk_to_smallautofield_pk', # unexpected unique index in pg_constraint query: # https://github.com/cockroachdb/cockroach/issues/61098 'introspection.tests.IntrospectionTests.test_get_constraints_unique_indexes_orders', @@ -181,7 +182,7 @@ def django_test_expected_failures(self): # concat(): unknown signature: concat(string, int2) (desired ) 'db_functions.text.test_concat.ConcatTests.test_concat_non_str', # unknown signature: concat(varchar, int) (returning ) - 'migrations.test_operations.OperationTests.test_add_generate_field', + 'migrations.test_operations.OperationTests.test_add_generated_field', }) if self.is_cockroachdb_24_1: # USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229 diff --git a/django_cockroachdb_gis/features.py b/django_cockroachdb_gis/features.py index 24de070..42fdeb4 100644 --- a/django_cockroachdb_gis/features.py +++ b/django_cockroachdb_gis/features.py @@ -68,6 +68,7 @@ def django_test_expected_failures(self): # data is currently not supported for columns that are part of an # index: https://github.com/cockroachdb/cockroach/issues/47636 'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_geom_field_dim', + 'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_with_spatial_index', # 3D opclass not present on CockroachDB: # https://github.com/cockroachdb/cockroach/issues/47420#issuecomment-969578772 'gis_tests.gis_migrations.test_operations.OperationTests.test_add_3d_field_opclass', diff --git a/django_cockroachdb_gis/schema.py b/django_cockroachdb_gis/schema.py index 53d7492..f6600c2 100644 --- a/django_cockroachdb_gis/schema.py +++ b/django_cockroachdb_gis/schema.py @@ -5,5 +5,5 @@ ) -class DatabaseSchemaEditor(CockroachSchemaEditor, PostGISSchemaEditor): +class DatabaseSchemaEditor(PostGISSchemaEditor, CockroachSchemaEditor): pass diff --git a/setup.cfg b/setup.cfg index a0d6e71..6f7d3e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ long_description_content_type = text/markdown classifiers = Development Status :: 5 - Production/Stable Framework :: Django - Framework :: Django :: 5.1 + Framework :: Django :: 5.2 License :: OSI Approved :: Apache Software License Operating System :: OS Independent Programming Language :: Python @@ -27,7 +27,7 @@ project_urls = python_requires = >=3.10 packages = find: install_requires = - django >= 5.1, < 5.2 +# django >= 5.2, < 6.0 [flake8] max-line-length = 119 From d95b593c63bffb8f86174fde744d8d300b143011 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 19 Nov 2024 15:36:21 -0500 Subject: [PATCH 3/3] nov 19 w/composite fk