summaryrefslogtreecommitdiff
path: root/alembic/templates/generic/env.py
diff options
context:
space:
mode:
Diffstat (limited to 'alembic/templates/generic/env.py')
-rw-r--r--alembic/templates/generic/env.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/alembic/templates/generic/env.py b/alembic/templates/generic/env.py
index 058378b..f3df952 100644
--- a/alembic/templates/generic/env.py
+++ b/alembic/templates/generic/env.py
@@ -37,7 +37,8 @@ def run_migrations_offline():
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
- url=url, target_metadata=target_metadata, literal_binds=True)
+ url=url, target_metadata=target_metadata, literal_binds=True
+ )
with context.begin_transaction():
context.run_migrations()
@@ -52,18 +53,19 @@ def run_migrations_online():
"""
connectable = engine_from_config(
config.get_section(config.config_ini_section),
- prefix='sqlalchemy.',
- poolclass=pool.NullPool)
+ prefix="sqlalchemy.",
+ poolclass=pool.NullPool,
+ )
with connectable.connect() as connection:
context.configure(
- connection=connection,
- target_metadata=target_metadata
+ connection=connection, target_metadata=target_metadata
)
with context.begin_transaction():
context.run_migrations()
+
if context.is_offline_mode():
run_migrations_offline()
else: