fix: enforce durable migration ownership and readiness
This commit is contained in:
parent
14befd0b50
commit
826874a47e
5 changed files with 52 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ from alembic import context
|
|||
from sqlalchemy import engine_from_config, pool
|
||||
|
||||
from hub_core.models import Base
|
||||
from hub_core.migrations.roles import migration_role_statement
|
||||
|
||||
config = context.config
|
||||
|
||||
|
|
@ -38,6 +39,8 @@ def run_migrations_online() -> None:
|
|||
poolclass=pool.NullPool,
|
||||
)
|
||||
with connectable.connect() as connection:
|
||||
if statement := migration_role_statement(os.environ.get("HUB_CORE_MIGRATION_ROLE")):
|
||||
connection.exec_driver_sql(statement)
|
||||
context.configure(connection=connection, target_metadata=target_metadata)
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue