diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/checks.txt | 5 | ||||
| -rw-r--r-- | docs/ref/databases.txt | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 5f9f9301ed..2ebaf5201f 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -127,9 +127,12 @@ MySQL and MariaDB If you're using MySQL or MariaDB, the following checks will be performed: * **mysql.E001**: MySQL/MariaDB does not allow unique ``CharField``\s to have a - ``max_length`` > 255. + ``max_length`` > 255. *This check was changed to* ``mysql.W003`` *in Django + 3.1 as the real maximum size depends on many factors.* * **mysql.W002**: MySQL/MariaDB Strict Mode is not set for database connection '<alias>'. See also :ref:`mysql-sql-mode`. +* **mysql.W003**: MySQL/MariaDB may not allow unique ``CharField``\s to have a + ``max_length`` > 255. Model fields ------------ diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index f61158c191..4d4a7d2aa9 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -581,13 +581,18 @@ these methods in no-op's based in the results of such detection. Notes on specific fields ------------------------ +.. _mysql-character-fields: + Character fields ~~~~~~~~~~~~~~~~ -Any fields that are stored with ``VARCHAR`` column types have their +Any fields that are stored with ``VARCHAR`` column types may have their ``max_length`` restricted to 255 characters if you are using ``unique=True`` for the field. This affects :class:`~django.db.models.CharField`, -:class:`~django.db.models.SlugField`. +:class:`~django.db.models.SlugField`. See `the MySQL documentation`_ for more +details. + +.. _the MySQL documentation: https://dev.mysql.com/doc/refman/en/create-index.html#create-index-column-prefixes ``TextField`` limitations ~~~~~~~~~~~~~~~~~~~~~~~~~ |
