1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #31144 -- Relaxed system check for max_length of CharFields on MySQL/MariaDB by turning into a warning.

This commit is contained in:
Rohit
2020-02-08 22:21:31 +05:30
committed by Mariusz Felisiak
parent c1c361677d
commit 2695ac8e04
4 changed files with 26 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ from django.test.utils import isolate_apps, override_settings
from django.utils.functional import lazy
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from django.utils.version import get_docs_version
@isolate_apps('invalid_models_tests')
@@ -372,11 +373,15 @@ class CharFieldTests(SimpleTestCase):
field = Model._meta.get_field('field')
validator = DatabaseValidation(connection=connection)
self.assertEqual(validator.check_field(field), [
Error(
'%s does not allow unique CharFields to have a max_length > '
DjangoWarning(
'%s may not allow unique CharFields to have a max_length > '
'255.' % connection.display_name,
hint=(
'See: https://docs.djangoproject.com/en/%s/ref/databases/'
'#mysql-character-fields' % get_docs_version()
),
obj=field,
id='mysql.E001',
id='mysql.W003',
)
])