summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yoyo/backends/core/postgresql.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/yoyo/backends/core/postgresql.py b/yoyo/backends/core/postgresql.py
index 17e9963..09d0f06 100644
--- a/yoyo/backends/core/postgresql.py
+++ b/yoyo/backends/core/postgresql.py
@@ -64,16 +64,6 @@ class PostgresqlBackend(DatabaseBackend):
connection.autocommit = autocommit
return connection
- def transaction(self, rollback_on_exit=False):
-
- if self.connection.info.transaction_status != self.TRANSACTION_STATUS_IDLE:
- warnings.warn(
- "Nested transaction requested; "
- "this will raise an exception in some "
- "PostgreSQL-compatible databases"
- )
- return super().transaction(rollback_on_exit=rollback_on_exit)
-
@contextmanager
def disable_transactions(self):
with super(PostgresqlBackend, self).disable_transactions():
@@ -101,6 +91,15 @@ class PostgresqlBackend(DatabaseBackend):
self.execute("ROLLBACK")
super().rollback()
+ def begin(self):
+ if self.connection.info.transaction_status != self.TRANSACTION_STATUS_IDLE:
+ warnings.warn(
+ "Nested transaction requested; "
+ "this will raise an exception in some "
+ "PostgreSQL-compatible databases"
+ )
+ return super().begin()
+
class PostgresqlPsycopgBackend(PostgresqlBackend):
"""