diff options
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/features.py | 1 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/introspection.py | 6 |
3 files changed, 6 insertions, 3 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index fff65197f9..7a4439ae88 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -104,6 +104,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): 'PositiveIntegerField': 'integer unsigned', 'PositiveSmallIntegerField': 'smallint unsigned', 'SlugField': 'varchar(%(max_length)s)', + 'SmallAutoField': 'integer', 'SmallIntegerField': 'smallint', 'TextField': 'text', 'TimeField': 'time', @@ -116,6 +117,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): data_types_suffix = { 'AutoField': 'AUTOINCREMENT', 'BigAutoField': 'AUTOINCREMENT', + 'SmallAutoField': 'AUTOINCREMENT', } # SQLite requires LIKE statements to include an ESCAPE clause if the value # being escaped has a percent or underscore in it. diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index 3d52a8036f..18b76f8c86 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -19,6 +19,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): can_introspect_positive_integer_field = True can_introspect_small_integer_field = True introspected_big_auto_field_type = 'AutoField' + introspected_small_auto_field_type = 'AutoField' supports_transactions = True atomic_transactions = False can_rollback_ddl = True diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index faf9328415..5e33d2a7e2 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -57,9 +57,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): def get_field_type(self, data_type, description): field_type = super().get_field_type(data_type, description) - if description.pk and field_type in {'BigIntegerField', 'IntegerField'}: - # No support for BigAutoField as SQLite treats all integer primary - # keys as signed 64-bit integers. + if description.pk and field_type in {'BigIntegerField', 'IntegerField', 'SmallIntegerField'}: + # No support for BigAutoField or SmallAutoField as SQLite treats + # all integer primary keys as signed 64-bit integers. return 'AutoField' return field_type |
