Merge "db: Don't rely on branched connections"
This commit is contained in:
commit
c472d829fa
@ -95,13 +95,19 @@ def run_migrations_online():
|
||||
prefix="sqlalchemy.",
|
||||
poolclass=pool.NullPool,
|
||||
)
|
||||
with connectable.connect() as connection:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
include_name=include_name,
|
||||
)
|
||||
|
||||
# when connectable is already a Connection object, calling connect() gives
|
||||
# us a *branched connection*.
|
||||
|
||||
with connectable.connect() as connection:
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
else:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
connection=connectable,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
include_name=include_name,
|
||||
|
@ -101,13 +101,19 @@ def run_migrations_online():
|
||||
prefix="sqlalchemy.",
|
||||
poolclass=pool.NullPool,
|
||||
)
|
||||
with connectable.connect() as connection:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
include_name=include_name,
|
||||
)
|
||||
|
||||
# when connectable is already a Connection object, calling connect() gives
|
||||
# us a *branched connection*.
|
||||
|
||||
with connectable.connect() as connection:
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
else:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
connection=connectable,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
include_name=include_name,
|
||||
|
Loading…
Reference in New Issue
Block a user