diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 63f8f9d973..0c328a50c8 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -518,8 +518,6 @@ class BaseDatabaseFeatures(object): supports_subqueries_in_group_by = True supports_bitwise_or = True - supports_boolean_type = True - supports_binary_field = True # Do time/datetime fields have microsecond precision? @@ -581,6 +579,9 @@ class BaseDatabaseFeatures(object): # Can the backend introspect an BinaryField, instead of an TextField? can_introspect_binary_field = True + # Can the backend introspect an BooleanField, instead of an IntegerField? + can_introspect_boolean_field = True + # Can the backend introspect an IPAddressField, instead of an CharField? can_introspect_ip_address_field = False @@ -639,7 +640,7 @@ class BaseDatabaseFeatures(object): # Suffix for backends that don't support "SELECT xxx;" queries. bare_select_suffix = '' - lowercases_column_names = False + uppercases_column_names = True def __init__(self, connection): self.connection = connection diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 3c71c5792c..9172d7069a 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -172,13 +172,13 @@ class DatabaseFeatures(BaseDatabaseFeatures): has_select_for_update_nowait = False supports_forward_references = False supports_long_model_names = False - supports_boolean_type = False # XXX MySQL DB-API drivers currently fail on binary data on Python 3. supports_binary_field = six.PY2 supports_microsecond_precision = False supports_regex_backreferencing = False supports_date_lookup_using_string = False can_introspect_binary_field = False + can_introspect_boolean_field = False supports_timezones = False requires_explicit_null_ordering_when_grouping = True allows_auto_pk_0 = False diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 312eb7e40b..f945b26101 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -120,7 +120,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): connection_persists_old_columns = True closed_cursor_error_class = InterfaceError bare_select_suffix = " FROM DUAL" - lowercases_column_names = True + uppercases_column_names = False class DatabaseOperations(BaseDatabaseOperations): diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py index 856e63ce4a..92a5a02dbd 100644 --- a/tests/inspectdb/tests.py +++ b/tests/inspectdb/tests.py @@ -87,7 +87,7 @@ class InspectDBTestCase(TestCase): else: assertFieldType('big_int_field', "models.IntegerField()") - if connection.features.supports_boolean_type: + if connection.features.can_introspect_boolean_field: assertFieldType('bool_field', "models.BooleanField()") assertFieldType('null_bool_field', "models.NullBooleanField()") else: @@ -176,7 +176,7 @@ class InspectDBTestCase(TestCase): out = StringIO() call_command('inspectdb', stdout=out) output = out.getvalue() - base_name = 'field' if connection.features.lowercases_column_names else 'Field' + base_name = 'field' if not connection.features.uppercases_column_names else 'Field' self.assertIn("field = models.IntegerField()", output) self.assertIn("field_field = models.IntegerField(db_column='%s_')" % base_name, output) self.assertIn("field_field_0 = models.IntegerField(db_column='%s__')" % base_name, output) diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index fe7c3cefba..fee6e59544 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -57,7 +57,8 @@ class IntrospectionTests(TestCase): self.assertEqual( [datatype(r[1], r) for r in desc], ['AutoField' if connection.features.can_introspect_autofield else 'IntegerField', - 'CharField', 'CharField', 'CharField', 'BigIntegerField', + 'CharField', 'CharField', 'CharField', + 'BigIntegerField' if connection.features.can_introspect_big_integer_field else 'IntegerField', 'BinaryField' if connection.features.can_introspect_binary_field else 'TextField'] ) diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 5ee2a93a6f..22db69ba13 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -449,6 +449,7 @@ class SerializerTests(TestCase): self.assertEqual(base_data, proxy_proxy_data.replace('proxy', '')) +@skipUnlessDBFeature('supports_binary_field') def serializerTest(format, self): # Create all the objects defined in the test data @@ -481,8 +482,6 @@ def serializerTest(format, self): for klass, count in instance_count.items(): self.assertEqual(count, klass.objects.count()) -serializerTest = skipUnlessDBFeature('supports_binary_field')(serializerTest) - def naturalKeySerializerTest(format, self): # Create all the objects defined in the test data