From eade315da1c8372ac1dfcf1fd20ea87f454d71ac Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 6 Sep 2013 12:18:16 -0400 Subject: Fixed #10164 -- Made AutoField increase monotonically on SQLite Thanks malte for the report. --- django/db/backends/sqlite3/base.py | 1 + django/db/backends/sqlite3/creation.py | 3 +++ django/db/backends/sqlite3/introspection.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'django/db/backends/sqlite3') diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 385733cb8d..889630faf9 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -106,6 +106,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_check_constraints = False autocommits_when_autocommit_is_off = True supports_paramstyle_pyformat = False + supports_sequence_reset = False @cached_property def uses_savepoints(self): diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py index 435cee3436..bdd4560516 100644 --- a/django/db/backends/sqlite3/creation.py +++ b/django/db/backends/sqlite3/creation.py @@ -34,6 +34,9 @@ class DatabaseCreation(BaseDatabaseCreation): 'TextField': 'text', 'TimeField': 'time', } + data_types_suffix = { + 'AutoField': 'AUTOINCREMENT', + } def sql_for_pending_references(self, model, style, pending_references): "SQLite3 doesn't support constraints" diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index f1d433fe0f..55e68c34b9 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -175,7 +175,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): results = results[results.index('(') + 1:results.rindex(')')] for field_desc in results.split(','): field_desc = field_desc.strip() - m = re.search('"(.*)".*PRIMARY KEY$', field_desc) + m = re.search('"(.*)".*PRIMARY KEY( AUTOINCREMENT)?$', field_desc) if m: return m.groups()[0] return None -- cgit v1.3