diff --git a/flask_migrate/templates/flask/env.py b/flask_migrate/templates/flask/env.py index 23663ff..2d31c5a 100644 --- a/flask_migrate/templates/flask/env.py +++ b/flask_migrate/templates/flask/env.py @@ -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()