14 lines
440 B
Python
14 lines
440 B
Python
from alembic.config import Config
|
|
from alembic import command
|
|
import asyncio
|
|
from sqlalchemy.ext.asyncio import AsyncEngine
|
|
from alembic import command, config
|
|
|
|
def run_upgrade(connection, cfg):
|
|
cfg.attributes["connection"] = connection
|
|
command.upgrade(cfg, "head")
|
|
|
|
async def migrate_db(async_engine: AsyncEngine):
|
|
async with async_engine.begin() as conn:
|
|
await conn.run_sync(run_upgrade, config.Config("alembic.ini"))
|