Merge "db: Don't rely on branched connections"
This commit is contained in:
commit
3ca2d4fdc8
@ -63,13 +63,18 @@ def run_migrations_online():
|
|||||||
connectable = engine_from_config(
|
connectable = engine_from_config(
|
||||||
config.get_section(config.config_ini_section),
|
config.get_section(config.config_ini_section),
|
||||||
prefix='sqlalchemy.', poolclass=pool.NullPool)
|
prefix='sqlalchemy.', poolclass=pool.NullPool)
|
||||||
with connectable.connect() as connection:
|
with connectable.connect() as connection:
|
||||||
context.configure(connection=connection,
|
context.configure(connection=connection,
|
||||||
target_metadata=target_metadata)
|
target_metadata=target_metadata)
|
||||||
|
with context.begin_transaction():
|
||||||
|
context.run_migrations()
|
||||||
|
else:
|
||||||
|
context.configure(
|
||||||
|
connection=connectable,
|
||||||
|
target_metadata=target_metadata)
|
||||||
with context.begin_transaction():
|
with context.begin_transaction():
|
||||||
context.run_migrations()
|
context.run_migrations()
|
||||||
|
|
||||||
|
|
||||||
if context.is_offline_mode():
|
if context.is_offline_mode():
|
||||||
run_migrations_offline()
|
run_migrations_offline()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user