Extracts the ticket/attachment system into a reusable pip-installable package. Centralises homelab MCP server (tickets, attachments, system logs) here. - corvid package: models, router (make_router factory), config, standalone main - Alembic migration chain for fresh standalone deployments - Docker Compose for standalone deployment (port 8090) - mcp_server.py: moved from homelab-dashboard, CORVID_REPO_PATH configurable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
886 B
Python
33 lines
886 B
Python
import asyncio
|
|
from logging.config import fileConfig
|
|
|
|
from sqlalchemy.ext.asyncio import create_async_engine
|
|
|
|
from alembic import context
|
|
|
|
alembic_cfg = context.config
|
|
|
|
if alembic_cfg.config_file_name is not None:
|
|
fileConfig(alembic_cfg.config_file_name)
|
|
|
|
from corvid import config as app_config
|
|
from corvid.models import Base # noqa: E402 — registers models
|
|
|
|
target_metadata = Base.metadata
|
|
|
|
|
|
def do_run_migrations(connection):
|
|
context.configure(connection=connection, target_metadata=target_metadata)
|
|
with context.begin_transaction():
|
|
context.run_migrations()
|
|
|
|
|
|
async def run_async_migrations():
|
|
engine = create_async_engine(app_config.DATABASE_URL)
|
|
async with engine.begin() as conn:
|
|
await conn.run_sync(do_run_migrations)
|
|
await engine.dispose()
|
|
|
|
|
|
run_migrations_online = lambda: asyncio.run(run_async_migrations())
|
|
run_migrations_online()
|