summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2021-12-07 11:32:05 +0000
committerGitHub <noreply@github.com>2021-12-07 12:32:05 +0100
commit063cf98d3a6839f40c423cbd845def429c5cf0ce (patch)
tree047ffe72e30472a37890fcd51efd1fac5e2993f0 /django/db/backends/sqlite3/base.py
parentadef3d975e55c55b020c2f357d82c2db11e58450 (diff)
Fixed #31765 -- Enforced enhanced ALTER TABLE behavior for SQLite connections.
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 6f5168f159..170c0785b9 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -259,6 +259,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
conn.create_aggregate('VAR_POP', 1, list_aggregate(statistics.pvariance))
conn.create_aggregate('VAR_SAMP', 1, list_aggregate(statistics.variance))
conn.execute('PRAGMA foreign_keys = ON')
+ # The macOS bundled SQLite defaults legacy_alter_table ON, which
+ # prevents atomic table renames (feature supports_atomic_references_rename)
+ conn.execute('PRAGMA legacy_alter_table = OFF')
return conn
def init_connection_state(self):