refactor: Update migration functions to accept connection parameter for improved flexibility and consistency #30

Merged
mo merged 1 commits from ph4 into prod 2025-06-01 17:39:22 +02:00
Showing only changes of commit 0f9d83a233 - Show all commits

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,