Skip to content

Commit c07e996

Browse files
committed
oct 25
1 parent 10e0f8e commit c07e996

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

django_cockroachdb/features.py

Lines changed: 4 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 {

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.

0 commit comments

Comments
 (0)