Files
pesco-ncr/backend/app/dev_init.py

22 lines
629 B
Python
Raw Normal View History

"""Create the schema directly from the models — for LOCAL SQLite development
only (`python -m app.dev_init`). Real MySQL deployments use Alembic
(`alembic upgrade head`), which also creates the Power BI reporting views.
"""
import asyncio
from app.config import get_settings
from app.database import get_engine
from app.models import Base
async def main() -> None:
url = get_settings().effective_database_url
engine = get_engine()
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
print(f"Schema created for {url}")
if __name__ == "__main__":
asyncio.run(main())