summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-06-22 14:42:51 -0400
committerTim Graham <timograham@gmail.com>2018-06-25 14:01:04 -0400
commitb9cf764be62e77b4777b3a75ec256f6209a57671 (patch)
treed4eb2e5cc340316fa277528044ee35d1ac473dc5 /django/db/backends/sqlite3/base.py
parent741061852851d6aff8e35f46b0e165685d3e79e0 (diff)
Fixed #29517 -- Added support for SQLite column check constraints on positive integer fields.
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index b644f4d42a..6237c3b6f8 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -76,6 +76,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'TimeField': 'time',
'UUIDField': 'char(32)',
}
+ data_type_check_constraints = {
+ 'PositiveIntegerField': '"%(column)s" >= 0',
+ 'PositiveSmallIntegerField': '"%(column)s" >= 0',
+ }
data_types_suffix = {
'AutoField': 'AUTOINCREMENT',
'BigAutoField': 'AUTOINCREMENT',