summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-12-21 18:26:30 -0500
committerTim Graham <timograham@gmail.com>2018-12-22 15:14:33 -0500
commit6b9bd0933e0ce7e9bfcb2bcc5c8a6dc3486b4257 (patch)
tree66b6585df450a1d4046689148890480ed32cf021
parentf3eb1cfb58084bd2c547e64a217cb6da0ddfb0df (diff)
Refs #29928 -- Added supports_pragma_foreign_key_check SQLite feature flag.
-rw-r--r--django/db/backends/sqlite3/base.py2
-rw-r--r--django/db/backends/sqlite3/features.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 5d8f4028c2..1c39fb4add 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -267,7 +267,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
determine if rows with invalid references were entered while constraint
checks were off.
"""
- if Database.sqlite_version_info >= (3, 20, 0):
+ if self.features.supports_pragma_foreign_key_check:
with self.cursor() as cursor:
if table_names is None:
violations = self.cursor().execute('PRAGMA foreign_key_check').fetchall()
diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py
index e315c86712..612ae735be 100644
--- a/django/db/backends/sqlite3/features.py
+++ b/django/db/backends/sqlite3/features.py
@@ -40,7 +40,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_parentheses_in_compound = False
# Deferred constraint checks can be emulated on SQLite < 3.20 but not in a
# reasonably performant way.
- can_defer_constraint_checks = Database.sqlite_version_info >= (3, 20, 0)
+ supports_pragma_foreign_key_check = Database.sqlite_version_info >= (3, 20, 0)
+ can_defer_constraint_checks = supports_pragma_foreign_key_check
@cached_property
def supports_stddev(self):