summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-12-21 19:47:47 -0500
committerTim Graham <timograham@gmail.com>2018-12-22 15:26:46 -0500
commit790d108c97f0cf9caa02c72791f2bf158d308fcd (patch)
tree2b44ff39b7c0fab5a401fc1ae60da80077696025
parent6b9bd0933e0ce7e9bfcb2bcc5c8a6dc3486b4257 (diff)
Refs #30033 -- Checked constraints before committing SQLite schema changes.
This order of operations is more in line with SQLite's documented table rebuild procedure and ensures that changes aren't committed if foreign key integrity is broken.
-rw-r--r--django/db/backends/sqlite3/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index edc128fca2..1a4b94fa82 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -30,8 +30,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return super().__enter__()
def __exit__(self, exc_type, exc_value, traceback):
- super().__exit__(exc_type, exc_value, traceback)
self.connection.check_constraints()
+ super().__exit__(exc_type, exc_value, traceback)
self.connection.enable_constraint_checking()
def quote_value(self, value):