Ver código fonte

Refs #29548 -- Fixed DatabaseWrapper.display_name on MariaDB.

Mariusz Felisiak 5 anos atrás
pai
commit
8d52a525c8

+ 4 - 1
django/db/backends/mysql/base.py

@@ -97,7 +97,6 @@ class CursorWrapper:
 
 class DatabaseWrapper(BaseDatabaseWrapper):
     vendor = 'mysql'
-    display_name = 'MySQL'
     # This dictionary maps Field objects to their associated MySQL column
     # types, as strings. Column-type strings can contain format strings; they'll
     # be interpolated against the values of Field.__dict__ before being output.
@@ -329,6 +328,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
         else:
             return True
 
+    @cached_property
+    def display_name(self):
+        return 'MariaDB' if self.mysql_is_mariadb else 'MySQL'
+
     @cached_property
     def data_type_check_constraints(self):
         if self.features.supports_column_check_constraints:

+ 2 - 2
django/db/backends/mysql/validation.py

@@ -47,8 +47,8 @@ class DatabaseValidation(BaseDatabaseValidation):
         if field.db_index and field_type.lower() in self.connection._limited_data_types:
             errors.append(
                 checks.Warning(
-                    'MySQL does not support a database index on %s columns.'
-                    % field_type,
+                    '%s does not support a database index on %s columns.'
+                    % (self.connection.display_name, field_type),
                     hint=(
                         "An index won't be created. Silence this warning if "
                         "you don't care about it."