diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 08632a0..54fb2fe 100644
a
|
b
|
class CursorWrapper:
|
57 | 57 | Implemented as a wrapper, rather than a subclass, so that it isn't stuck |
58 | 58 | to the particular underlying representation returned by Connection.cursor(). |
59 | 59 | """ |
60 | | codes_for_integrityerror = (1048,) |
| 60 | codes_for_integrityerror = ( |
| 61 | 1048, # Column cannot be null |
| 62 | 1690, # BIGINT UNSIGNED value is out of range |
| 63 | ) |
61 | 64 | |
62 | 65 | def __init__(self, cursor): |
63 | 66 | self.cursor = cursor |
diff --git a/tests/model_fields/test_integerfield.py b/tests/model_fields/test_integerfield.py
index 99d7b17..8661c28 100644
a
|
b
|
|
1 | 1 | from django.core import validators |
2 | 2 | from django.core.exceptions import ValidationError |
3 | | from django.db import connection, models |
| 3 | from django.db import IntegrityError, connection, models |
4 | 4 | from django.test import SimpleTestCase, TestCase |
5 | 5 | |
6 | 6 | from .models import ( |
… |
… |
class PositiveIntegerFieldTests(IntegerFieldTests):
|
151 | 151 | model = PositiveIntegerModel |
152 | 152 | documented_range = (0, 2147483647) |
153 | 153 | |
| 154 | def test_negative_values(self): |
| 155 | p = PositiveIntegerModel.objects.create(value=0) |
| 156 | p.value = models.F('value') - 1 |
| 157 | with self.assertRaises(IntegrityError): |
| 158 | p.save() |
| 159 | |
154 | 160 | |
155 | 161 | class ValidationTests(SimpleTestCase): |
156 | 162 | |