summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/validation.py
diff options
context:
space:
mode:
authorRohit <rjha@ph.iitr.ac.in>2020-02-08 22:21:31 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-03-20 12:28:10 +0100
commit2695ac8e0441b4d7e5460eac3bb7ea315164a6bf (patch)
tree71df528790f275a1877123f79fb7bd4e8a097b52 /django/db/backends/mysql/validation.py
parentc1c361677d9400c8e2cdaddda0c16086bb358492 (diff)
downloaddjango-2695ac8e0441b4d7e5460eac3bb7ea315164a6bf.tar.gz
Fixed #31144 -- Relaxed system check for max_length of CharFields on MySQL/MariaDB by turning into a warning.
Diffstat (limited to 'django/db/backends/mysql/validation.py')
-rw-r--r--django/db/backends/mysql/validation.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/db/backends/mysql/validation.py b/django/db/backends/mysql/validation.py
index fc4dc500e1..41e600a856 100644
--- a/django/db/backends/mysql/validation.py
+++ b/django/db/backends/mysql/validation.py
@@ -41,11 +41,15 @@ class DatabaseValidation(BaseDatabaseValidation):
if (field_type.startswith('varchar') and field.unique and
(field.max_length is None or int(field.max_length) > 255)):
errors.append(
- checks.Error(
- '%s does not allow unique CharFields to have a max_length '
+ checks.Warning(
+ '%s may not allow unique CharFields to have a max_length '
'> 255.' % self.connection.display_name,
obj=field,
- id='mysql.E001',
+ hint=(
+ 'See: https://docs.djangoproject.com/en/%s/ref/'
+ 'databases/#mysql-character-fields' % get_docs_version()
+ ),
+ id='mysql.W003',
)
)