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:
@@ -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',
|
||||
)
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user