mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +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:
parent
b22d6c47a7
commit
d3cf6cfacf
7 changed files with 16 additions and 12 deletions
|
@ -934,10 +934,9 @@ class ThreadTests(TestCase):
|
|||
class MySQLPKZeroTests(TestCase):
|
||||
"""
|
||||
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 autoincrement primary key.
|
||||
"""
|
||||
|
||||
@skipIfDBFeature('allows_primary_key_0')
|
||||
@skipIfDBFeature('allows_auto_pk_0')
|
||||
def test_zero_as_autoval(self):
|
||||
with self.assertRaises(ValueError):
|
||||
models.Square.objects.create(id=0, root=0, square=1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue