Skip to content

Commit

Permalink
Don't swallow transaction errors (#236)
Browse files Browse the repository at this point in the history
A change proposed by @kjohnsen from #216.

You can read more starting with [this comment](#216 (comment)).
  • Loading branch information
killthekitten authored and miguelgrinberg committed Nov 8, 2018
1 parent 9b29120 commit 87b40ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flask_migrate/templates/flask/env.py
Expand Up @@ -74,10 +74,13 @@ def process_revision_directives(context, revision, directives):
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions['migrate'].configure_args)

try:
with context.begin_transaction():
context.run_migrations()
except Exception as exception:
logger.error(exception)
raise exception
finally:
connection.close()

Expand Down

0 comments on commit 87b40ec

Please sign in to comment.