summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2022-11-03 09:12:48 +0000
committerOlly Cope <olly@ollycope.com>2022-11-03 09:12:48 +0000
commite4b7a5a0e18d45fa1a07a2a0983eef25c304d391 (patch)
tree34e69ca314886926d65486baa91f62575830b54e
parentf1f0b069345fbf4d7170e6dba1fd3b0d111eb6cc (diff)
downloadyoyo-e4b7a5a0e18d45fa1a07a2a0983eef25c304d391.tar.gz
Remove unnecessary transaction
The transaction here does not appear to required and it causes a nested transaction warning in PostgreSQL.
-rw-r--r--yoyo/internalmigrations/__init__.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/yoyo/internalmigrations/__init__.py b/yoyo/internalmigrations/__init__.py
index 5bcb0b5..3164dfa 100644
--- a/yoyo/internalmigrations/__init__.py
+++ b/yoyo/internalmigrations/__init__.py
@@ -48,15 +48,12 @@ def get_current_version(backend):
return 0
if version_table not in tables:
return 1
- with backend.transaction():
- cursor = backend.execute(
- "SELECT max(version) FROM {} ".format(
- backend.quote_identifier(version_table)
- )
- )
- version = cursor.fetchone()[0]
- assert version in schema_versions
- return version
+ cursor = backend.execute(
+ f"SELECT max(version) FROM {backend.quote_identifier(version_table)}"
+ )
+ version = cursor.fetchone()[0]
+ assert version in schema_versions
+ return version
def mark_schema_version(backend, version):