Skip to content

Commit f7df3de

Browse files
committed
update for Django 4.2
* update SchemaEditor._alter_column_type_sql() signature for django/django@ae0899b
1 parent cfae1ef commit f7df3de

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

CHANGELOG.md

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
# Changelog
22

3-
## 4.1.1 - 2022-12-06
3+
## 4.2 - Unreleased
44

5-
- Made `dbshell` use `sslcert`, `sslkey`, `sslmode`, and `options` from the
6-
`'OPTIONS'` part of the `DATABASES` setting.
7-
- Added support for CockroachDB 22.2, which adds support for
8-
`QuerySet.select_for_update(skip_locked=True)`.
9-
10-
## 4.1 - 2022-08-03
11-
12-
Initial release for Django 4.1.x and CockroachDB 21.2.x and 22.1.x.
5+
Initial release for Django 4.2.x and CockroachDB 22.1.x and 22.2.x.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ production it is advised to use the package built from sources.
1616
## Install and usage
1717

1818
Use the version of django-cockroachdb that corresponds to your version of
19-
Django. For example, to get the latest compatible release for Django 4.1.x:
19+
Django. For example, to get the latest compatible release for Django 4.2.x:
2020

21-
`pip install django-cockroachdb==4.1.*`
21+
`pip install django-cockroachdb==4.2.*`
2222

2323
The minor release number of Django doesn't correspond to the minor release
2424
number of django-cockroachdb. Use the latest minor release of each.

django_cockroachdb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '4.1.1'
1+
__version__ = '4.2a0'
22

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

django_cockroachdb/features.py

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def django_test_expected_failures(self):
133133
# https://go.crdb.dev/issue/47636
134134
'migrations.test_executor.ExecutorTests.test_alter_id_type_with_fk',
135135
'migrations.test_operations.OperationTests.test_alter_field_pk_fk',
136+
'migrations.test_operations.OperationTests.test_alter_field_pk_fk_char_to_int',
136137
'migrations.test_operations.OperationTests.test_alter_field_pk_fk_db_collation',
137138
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes',
138139
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_fk_with_to_field_related_name_target_type_change', # noqa

django_cockroachdb/schema.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
7575
}
7676
})
7777

78-
def _alter_column_type_sql(self, model, old_field, new_field, new_type):
79-
self.sql_alter_column_type = 'ALTER COLUMN %(column)s TYPE %(type)s'
78+
def _alter_column_type_sql(self, model, old_field, new_field, new_type, old_collation, new_collation):
8079
new_internal_type = new_field.get_internal_type()
8180
old_internal_type = old_field.get_internal_type()
8281
# Make ALTER TYPE with AutoField make sense.
@@ -90,6 +89,7 @@ def _alter_column_type_sql(self, model, old_field, new_field, new_type):
9089
self.sql_alter_column_type % {
9190
"column": self.quote_name(column),
9291
"type": new_type,
92+
"collation": "",
9393
},
9494
[],
9595
),
@@ -99,7 +99,10 @@ def _alter_column_type_sql(self, model, old_field, new_field, new_type):
9999
[],
100100
)
101101
else:
102-
return BaseDatabaseSchemaEditor._alter_column_type_sql(self, model, old_field, new_field, new_type)
102+
return BaseDatabaseSchemaEditor._alter_column_type_sql(
103+
self, model, old_field, new_field, new_type,
104+
old_collation, new_collation,
105+
)
103106

104107
def _field_should_be_indexed(self, model, field):
105108
# Foreign keys are automatically indexed by cockroachdb.

django_cockroachdb_gis/features.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def django_test_expected_failures(self):
5050
'gis_tests.distapp.tests.DistanceFunctionsTests.test_length',
5151
# Unsupported ~= (https://github.com/cockroachdb/cockroach/issues/57096)
5252
# and @ operators (https://github.com/cockroachdb/cockroach/issues/56124).
53-
'gis_tests.geogapp.tests.GeographyTest.test04_invalid_operators_functions',
53+
'gis_tests.geogapp.tests.GeographyTest.test_operators_functions_unavailable_for_geography',
5454
# unknown function: st_3dperimeter
5555
# https://github.com/cockroachdb/cockroach/issues/60871
5656
'gis_tests.geo3d.tests.Geo3DFunctionsTests.test_perimeter',

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ long_description_content_type = text/markdown
1111
classifiers =
1212
Development Status :: 5 - Production/Stable
1313
Framework :: Django
14-
Framework :: Django :: 4.1
14+
Framework :: Django :: 4.2
1515
License :: OSI Approved :: Apache Software License
1616
Operating System :: OS Independent
1717
Programming Language :: Python

teamcity-build/build-teamcity.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ VERSION="${1:-v19.2.5}"
77

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

1212
# install the django requirements.
1313
cd _django_repo/tests/
1414
pip3 install -e ..
1515
pip3 install -r requirements/py3.txt
16-
pip3 install -r requirements/postgres.txt
16+
pip3 install psycopg2
1717
cd ../..
1818

1919
# install the django-cockroachdb backend.

0 commit comments

Comments
 (0)