summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql_psycopg2')
-rw-r--r--django/db/backends/postgresql_psycopg2/creation.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/db/backends/postgresql_psycopg2/creation.py b/django/db/backends/postgresql_psycopg2/creation.py
index bdd817db4c..1f5609a158 100644
--- a/django/db/backends/postgresql_psycopg2/creation.py
+++ b/django/db/backends/postgresql_psycopg2/creation.py
@@ -76,3 +76,11 @@ class DatabaseCreation(BaseDatabaseCreation):
else:
output = []
return output
+
+ def set_autocommit(self):
+ self._prepare_for_test_db_ddl()
+
+ def _prepare_for_test_db_ddl(self):
+ """Rollback and close the active transaction."""
+ self.connection.connection.rollback()
+ self.connection.connection.set_isolation_level(0)