1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if NO_AUTO_VALUE_ON_ZERO SQL mode is enabled.

This commit is contained in:
Mariusz Felisiak
2020-07-20 09:48:31 +02:00
committed by GitHub
parent 730711e828
commit 83f55aafdd
7 changed files with 27 additions and 8 deletions

View File

@@ -115,7 +115,8 @@ class BulkCreateTests(TestCase):
def test_zero_as_autoval(self):
"""
Zero as id for AutoField should raise exception in MySQL, because MySQL
does not allow zero for automatic primary key.
does not allow zero for automatic primary key if the
NO_AUTO_VALUE_ON_ZERO SQL mode is not enabled.
"""
valid_country = Country(name='Germany', iso_two_letter='DE')
invalid_country = Country(id=0, name='Poland', iso_two_letter='PL')