Refs #29548 -- Mentioned MariaDB in database system checks.
This commit is contained in:
parent
fc0fa72ff4
commit
6e026aec5f
|
@ -12,12 +12,20 @@ class DatabaseValidation(BaseDatabaseValidation):
|
|||
def _check_sql_mode(self, **kwargs):
|
||||
if not (self.connection.sql_mode & {'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES'}):
|
||||
return [checks.Warning(
|
||||
"MySQL Strict Mode is not set for database connection '%s'" % self.connection.alias,
|
||||
hint="MySQL's Strict Mode fixes many data integrity problems in MySQL, "
|
||||
"such as data truncation upon insertion, by escalating warnings into "
|
||||
"errors. It is strongly recommended you activate it. See: "
|
||||
"https://docs.djangoproject.com/en/%s/ref/databases/#mysql-sql-mode"
|
||||
% (get_docs_version(),),
|
||||
"%s Strict Mode is not set for database connection '%s'"
|
||||
% (self.connection.display_name, self.connection.alias),
|
||||
hint=(
|
||||
"%s's Strict Mode fixes many data integrity problems in "
|
||||
"%s, such as data truncation upon insertion, by "
|
||||
"escalating warnings into errors. It is strongly "
|
||||
"recommended you activate it. See: "
|
||||
"https://docs.djangoproject.com/en/%s/ref/databases/#mysql-sql-mode"
|
||||
% (
|
||||
self.connection.display_name,
|
||||
self.connection.display_name,
|
||||
get_docs_version(),
|
||||
),
|
||||
),
|
||||
id='mysql.W002',
|
||||
)]
|
||||
return []
|
||||
|
@ -34,7 +42,8 @@ class DatabaseValidation(BaseDatabaseValidation):
|
|||
(field.max_length is None or int(field.max_length) > 255)):
|
||||
errors.append(
|
||||
checks.Error(
|
||||
'MySQL does not allow unique CharFields to have a max_length > 255.',
|
||||
'%s does not allow unique CharFields to have a max_length '
|
||||
'> 255.' % self.connection.display_name,
|
||||
obj=field,
|
||||
id='mysql.E001',
|
||||
)
|
||||
|
|
|
@ -121,14 +121,14 @@ configured:
|
|||
Database
|
||||
--------
|
||||
|
||||
MySQL
|
||||
~~~~~
|
||||
MySQL and MariaDB
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you're using MySQL, the following checks will be performed:
|
||||
If you're using MySQL or MariaDB, the following checks will be performed:
|
||||
|
||||
* **mysql.E001**: MySQL does not allow unique ``CharField``\s to have a
|
||||
* **mysql.E001**: MySQL/MariaDB does not allow unique ``CharField``\s to have a
|
||||
``max_length`` > 255.
|
||||
* **mysql.W002**: MySQL Strict Mode is not set for database connection
|
||||
* **mysql.W002**: MySQL/MariaDB Strict Mode is not set for database connection
|
||||
'<alias>'. See also :ref:`mysql-sql-mode`.
|
||||
|
||||
Model fields
|
||||
|
|
|
@ -373,7 +373,8 @@ class CharFieldTests(SimpleTestCase):
|
|||
validator = DatabaseValidation(connection=connection)
|
||||
self.assertEqual(validator.check_field(field), [
|
||||
Error(
|
||||
'MySQL does not allow unique CharFields to have a max_length > 255.',
|
||||
'%s does not allow unique CharFields to have a max_length > '
|
||||
'255.' % connection.display_name,
|
||||
obj=field,
|
||||
id='mysql.E001',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue