refactor: Update migration functions to accept connection parameter for improved flexibility and consistency
All checks were successful
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Successful in 1m16s
All checks were successful
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Successful in 1m16s
This commit is contained in:
parent
cb5bfcf7b5
commit
0f9d83a233
@ -26,9 +26,9 @@ async def run_migrations():
|
|||||||
|
|
||||||
async with engine.connect() as connection:
|
async with engine.connect() as connection:
|
||||||
# Get current database schema version
|
# Get current database schema version
|
||||||
def do_get_current_rev():
|
def do_get_current_rev(conn):
|
||||||
migration_context = MigrationContext.configure(
|
migration_context = MigrationContext.configure(
|
||||||
connection,
|
conn,
|
||||||
opts={
|
opts={
|
||||||
'target_metadata': DatabaseBase.metadata,
|
'target_metadata': DatabaseBase.metadata,
|
||||||
'compare_type': True,
|
'compare_type': True,
|
||||||
@ -40,9 +40,9 @@ async def run_migrations():
|
|||||||
current_rev = await connection.run_sync(do_get_current_rev)
|
current_rev = await connection.run_sync(do_get_current_rev)
|
||||||
|
|
||||||
# Run migrations
|
# Run migrations
|
||||||
def do_upgrade():
|
def do_upgrade(conn):
|
||||||
migration_context = MigrationContext.configure(
|
migration_context = MigrationContext.configure(
|
||||||
connection,
|
conn,
|
||||||
opts={
|
opts={
|
||||||
'target_metadata': DatabaseBase.metadata,
|
'target_metadata': DatabaseBase.metadata,
|
||||||
'compare_type': True,
|
'compare_type': True,
|
||||||
|
Loading…
Reference in New Issue
Block a user