summaryrefslogtreecommitdiff
path: root/yoyo/migrations.py
diff options
context:
space:
mode:
Diffstat (limited to 'yoyo/migrations.py')
-rwxr-xr-xyoyo/migrations.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/yoyo/migrations.py b/yoyo/migrations.py
index 5450d0a..5b30049 100755
--- a/yoyo/migrations.py
+++ b/yoyo/migrations.py
@@ -312,16 +312,14 @@ class TransactionWrapper(StepBase):
return "<TransactionWrapper {!r}>".format(self.step)
def apply(self, backend, force=False, direction="apply"):
- with backend.transaction() as transaction:
- try:
+ try:
+ with backend.transaction():
getattr(self.step, direction)(backend, force)
- except backend.DatabaseError:
- if force or self.ignore_errors in (direction, "all"):
- logger.exception("Ignored error in %r", self.step)
- transaction.rollback()
- return
- else:
- raise
+ except backend.DatabaseError:
+ if force or self.ignore_errors in (direction, "all"):
+ logger.exception("Ignored error in %r", self.step)
+ else:
+ raise
def rollback(self, backend, force=False):
self.apply(backend, force, "rollback")