diff --git a/django/contrib/gis/db/backends/base/features.py b/django/contrib/gis/db/backends/base/features.py index 4fd4fd18a7..779ff23689 100644 --- a/django/contrib/gis/db/backends/base/features.py +++ b/django/contrib/gis/db/backends/base/features.py @@ -40,6 +40,9 @@ class BaseSpatialFeatures(object): # Does the database have raster support? supports_raster = False + # Does the database support a unique index on geometry fields? + supports_geometry_field_unique_index = True + @property def supports_bbcontains_lookup(self): return 'bbcontains' in self.connection.ops.gis_operators diff --git a/django/contrib/gis/db/backends/oracle/features.py b/django/contrib/gis/db/backends/oracle/features.py index df0aedcf32..b0b7e27df8 100644 --- a/django/contrib/gis/db/backends/oracle/features.py +++ b/django/contrib/gis/db/backends/oracle/features.py @@ -6,3 +6,4 @@ from django.db.backends.oracle.features import \ class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_entry = False supports_geometry_field_introspection = False + supports_geometry_field_unique_index = False diff --git a/tests/gis_tests/geoapp/models.py b/tests/gis_tests/geoapp/models.py index 664aac9d7b..a819c17ada 100644 --- a/tests/gis_tests/geoapp/models.py +++ b/tests/gis_tests/geoapp/models.py @@ -63,7 +63,7 @@ class MultiFields(NamedModel): class Meta: unique_together = ('city', 'point') - required_db_features = ['gis_enabled'] + required_db_features = ['gis_enabled', 'supports_geometry_field_unique_index'] class Truth(models.Model):