Merge pull request 'refactor: Update migration functions to accept connection parameter for improved flexibility and consistency' (#30) from ph4 into prod

Reviewed-on: #30
This commit is contained in:
mo 2025-06-01 17:39:22 +02:00
commit 8517cbee99

View File

@ -26,9 +26,9 @@ async def run_migrations():
async with engine.connect() as connection:
# Get current database schema version
def do_get_current_rev():
def do_get_current_rev(conn):
migration_context = MigrationContext.configure(
connection,
conn,
opts={
'target_metadata': DatabaseBase.metadata,
'compare_type': True,
@ -40,9 +40,9 @@ async def run_migrations():
current_rev = await connection.run_sync(do_get_current_rev)
# Run migrations
def do_upgrade():
def do_upgrade(conn):
migration_context = MigrationContext.configure(
connection,
conn,
opts={
'target_metadata': DatabaseBase.metadata,
'compare_type': True,