Skip to content

Commit b60cd11

Browse files
committed
update for Django 6.1
1 parent f468f3e commit b60cd11

8 files changed

Lines changed: 25 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ using back to Cockroach Labs. To disable this, set
118118
- [greatest() doesn't support arguments of different types](https://github.com/cockroachdb/django-cockroachdb/issues/74):
119119
`greatest(): expected <arg> to be of type <type>, found type <other type>`
120120
- [`SmallAutoField` generates values that are too large for any corresponding foreign keys](https://github.com/cockroachdb/django-cockroachdb/issues/84).
121+
- The `BitXor` aggregate [isn't supported](https://github.com/cockroachdb/cockroach/issues/170352).
121122

122123
- GIS:
123124
- Some database functions aren't supported: `AsGML`, `AsKML`, `AsSVG`,

django-test-suite/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VERSION=$1
77

88
# clone django into the repo.
99
rm -rf _django_repo
10-
git clone --depth 1 --single-branch --branch cockroach-6.0.x https://github.com/timgraham/django _django_repo
10+
git clone --depth 1 --single-branch --branch cockroach-6.1.x https://github.com/timgraham/django _django_repo
1111

1212
# install the django requirements.
1313
cd _django_repo/tests/

django_cockroachdb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '6.0'
1+
__version__ = '6.1a0'
22

33
# Check Django compatibility before other imports which may fail if the
44
# wrong version of Django is installed.

django_cockroachdb/features.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
4848
# https://github.com/cockroachdb/cockroach/issues/95068
4949
supports_comments = False
5050

51+
# CockroachDB doesn't support UNIQUE NULLS NOT DISTINCT:
52+
# https://github.com/cockroachdb/cockroach/issues/115836
53+
supports_nulls_distinct_unique_constraints = False
54+
5155
@cached_property
5256
def introspected_field_types(self):
5357
return {
@@ -194,6 +198,14 @@ def django_test_expected_failures(self):
194198
'aggregation.tests.AggregateTestCase.test_aggregation_default_expression',
195199
# ProgrammingError: VALUES types int and float cannot be matched
196200
'field_defaults.tests.DefaultTests.test_bulk_create_mixed_db_defaults_function',
201+
# bit_xor function not supported:
202+
# https://github.com/cockroachdb/cockroach/issues/170352
203+
'aggregation.tests.AggregateTestCase.test_aggregation_default_integer',
204+
'aggregation.tests.AggregateTestCase.test_aggregation_default_unset',
205+
'aggregation.tests.AggregateTestCase.test_aggregation_default_zero',
206+
'aggregation.tests.AggregateTestCase.test_bit_xor',
207+
'aggregation.tests.AggregateTestCase.test_bit_xor_on_only_false_values',
208+
'aggregation.tests.AggregateTestCase.test_bit_xor_on_only_true_values',
197209
})
198210
if self.is_cockroachdb_25_1:
199211
expected_failures.update({

django_cockroachdb/functions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
)
66
from django.db.models.expressions import When
77
from django.db.models.functions import (
8-
ACos, ASin, ATan, ATan2, Cast, Ceil, Coalesce, Collate, Cos, Cot, Degrees,
9-
Exp, Floor, JSONArray, JSONObject, Ln, Log, Now, Radians, Round, Sin, Sqrt,
10-
StrIndex, Tan,
8+
UUID4, ACos, ASin, ATan, ATan2, Cast, Ceil, Coalesce, Collate, Cos, Cot,
9+
Degrees, Exp, Floor, JSONArray, JSONObject, Ln, Log, Now, Radians, Round,
10+
Sin, Sqrt, StrIndex, Tan,
1111
)
1212

1313

@@ -83,3 +83,4 @@ def register_functions():
8383
Round.as_cockroachdb = round_cast
8484
StrIndex.as_cockroachdb = StrIndex.as_postgresql
8585
When.as_cockroachdb = when
86+
UUID4.as_cockroachdb = UUID4.as_postgresql

django_cockroachdb/schema.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ class DatabaseSchemaEditor(PostgresDatabaseSchemaEditor):
1818

1919
# The PostgreSQL backend uses "SET CONSTRAINTS ... IMMEDIATE" after
2020
# creating this foreign key. This isn't supported by CockroachDB.
21-
sql_create_column_inline_fk = 'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)%(deferrable)s'
21+
sql_create_column_inline_fk = (
22+
'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)'
23+
'%(on_delete_db)s%(deferrable)s'
24+
)
2225

2326
# The PostgreSQL backend uses "SET CONSTRAINTS ... IMMEDIATE" after this
2427
# statement. This isn't supported by CockroachDB.

django_cockroachdb_gis/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def django_test_expected_failures(self):
3434
'gis_tests.geoapp.tests.GeoLookupTest.test_gis_lookups_with_complex_expressions',
3535
'gis_tests.geoapp.tests.GeoLookupTest.test_relate_lookup',
3636
# NotSupportedError: this box2d comparison operator is experimental
37-
'gis_tests.geoapp.tests.GeoLookupTest.test_contains_contained_lookups',
37+
'gis_tests.geoapp.tests.GeoLookupTest.test_bbcontains',
3838
# unknown signature: st_distancespheroid(geometry, geometry, string)
3939
# https://github.com/cockroachdb/cockroach/issues/48922#issuecomment-693096502
4040
'gis_tests.distapp.tests.DistanceTest.test_distance_lookups_with_expression_rhs',

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project_urls =
2727
python_requires = >=3.12
2828
packages = find:
2929
install_requires =
30-
django >= 6.0, < 6.1
30+
# django >= 6.1, < 6.2
3131

3232
[flake8]
3333
max-line-length = 119

0 commit comments

Comments
 (0)