mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #11964 -- Made constraint support check respect required_db_features.
This will notably silence the warnings issued when running the test suite on MySQL.
This commit is contained in:
parent
2fb872e56f
commit
8b3e1b6e9e
6 changed files with 67 additions and 26 deletions
|
@ -1191,3 +1191,13 @@ class ConstraintsTests(SimpleTestCase):
|
|||
)
|
||||
expected = [] if connection.features.supports_table_check_constraints else [warn, warn]
|
||||
self.assertCountEqual(errors, expected)
|
||||
|
||||
def test_check_constraints_required_db_features(self):
|
||||
class Model(models.Model):
|
||||
age = models.IntegerField()
|
||||
|
||||
class Meta:
|
||||
required_db_features = {'supports_table_check_constraints'}
|
||||
constraints = [models.CheckConstraint(check=models.Q(age__gte=18), name='is_adult')]
|
||||
|
||||
self.assertEqual(Model.check(), [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue