From 063cf98d3a6839f40c423cbd845def429c5cf0ce Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 7 Dec 2021 11:32:05 +0000 Subject: Fixed #31765 -- Enforced enhanced ALTER TABLE behavior for SQLite connections. --- django/db/backends/sqlite3/base.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'django/db/backends/sqlite3/base.py') 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): -- cgit v1.3