Files
PTSRaiAgent/app/db/bootstrap.py
T
Pavel Eliseev c42ef621e5
CI / ruff · pytest (pull_request) Successful in 55s
feat(questionnaire): integrate revised intake and follow-up monitoring
Add gated TSQ, Russian C-SSRS Recent, durable responses and notifications, diaries, schedules and audited clinical review. Preserve manual assessment when the Russian follow-up source is unavailable.

Refs #52
2026-10-03 18:19:34 +03:00

19 lines
827 B
Python

"""Schema bootstrap: `create_all` on both databases at startup (ADR-003: no Alembic in the MVP).
The only module (besides registration code) that touches both schemas — and only their metadata.
"""
from app.db import audit as _audit # noqa: F401 (registers audit_log in clinical metadata)
from app.db import intake as _intake # noqa: F401
from app.db.clinical import ClinicalBase
from app.db.identity import IdentityBase
from app.db.session import clinical_engine, identity_engine
async def init_db() -> None:
"""Create missing tables in the identity and clinical databases. Idempotent."""
async with identity_engine().begin() as conn:
await conn.run_sync(IdentityBase.metadata.create_all)
async with clinical_engine().begin() as conn:
await conn.run_sync(ClinicalBase.metadata.create_all)