Removed DatabaseFeatures.can_introspect_null.

The only known usage is in the unmaintained django-pymssql project.
This commit is contained in:
Tim Graham 2018-03-16 10:21:13 -04:00
parent 362813d628
commit f8b98f0edc
3 changed files with 2 additions and 13 deletions

View File

@ -109,13 +109,6 @@ class BaseDatabaseFeatures:
# Does the backend reset sequences between tests? # Does the backend reset sequences between tests?
supports_sequence_reset = True supports_sequence_reset = True
# Can the backend determine reliably if a field is nullable?
# Note that this is separate from interprets_empty_strings_as_nulls,
# although the latter feature, when true, interferes with correct
# setting (and introspection) of CharFields' nullability.
# This is True for all core backends.
can_introspect_null = True
# Can the backend introspect the default value of a column? # Can the backend introspect the default value of a column?
can_introspect_default = True can_introspect_default = True
@ -286,6 +279,6 @@ class BaseDatabaseFeatures:
introspection results; it should provide expectations, not run an introspection results; it should provide expectations, not run an
introspection itself. introspection itself.
""" """
if self.can_introspect_null and field and field.null: if field and field.null:
return 'NullBooleanField' return 'NullBooleanField'
return 'BooleanField' return 'BooleanField'

View File

@ -104,10 +104,7 @@ class InspectDBTestCase(TestCase):
if 'BooleanField' in null_bool_field_type: if 'BooleanField' in null_bool_field_type:
assertFieldType('null_bool_field', "models.{}()".format(null_bool_field_type)) assertFieldType('null_bool_field', "models.{}()".format(null_bool_field_type))
else: else:
if connection.features.can_introspect_null:
assertFieldType('null_bool_field', "models.{}(blank=True, null=True)".format(null_bool_field_type)) assertFieldType('null_bool_field', "models.{}(blank=True, null=True)".format(null_bool_field_type))
else:
assertFieldType('null_bool_field', "models.{}()".format(null_bool_field_type))
if connection.features.can_introspect_decimal_field: if connection.features.can_introspect_decimal_field:
assertFieldType('decimal_field', "models.DecimalField(max_digits=6, decimal_places=1)") assertFieldType('decimal_field', "models.DecimalField(max_digits=6, decimal_places=1)")

View File

@ -92,7 +92,6 @@ class IntrospectionTests(TransactionTestCase):
[30, 30, 254] [30, 30, 254]
) )
@skipUnlessDBFeature('can_introspect_null')
def test_get_table_description_nullable(self): def test_get_table_description_nullable(self):
with connection.cursor() as cursor: with connection.cursor() as cursor:
desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table)