mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #17713 -- Renamed BaseDatabaseFeatures.allows_primary_key_0 to allows_auto_pk_0.
MySQL does allow primary key with value 0. It only forbids autoincrement primary key with value 0. Thanks Claude Paroz for the report.
This commit is contained in:
@@ -70,13 +70,12 @@ class BulkCreateTests(TestCase):
|
||||
"CA", "IL", "ME", "NY",
|
||||
], attrgetter("two_letter_code"))
|
||||
|
||||
@skipIfDBFeature('allows_primary_key_0')
|
||||
@skipIfDBFeature('allows_auto_pk_0')
|
||||
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.
|
||||
"""
|
||||
|
||||
valid_country = Country(name='Germany', iso_two_letter='DE')
|
||||
invalid_country = Country(id=0, name='Poland', iso_two_letter='PL')
|
||||
with self.assertRaises(ValueError):
|
||||
|
||||
Reference in New Issue
Block a user