diff --git a/app/api/health.py b/app/api/health.py index 9406aed..5d5dd52 100644 --- a/app/api/health.py +++ b/app/api/health.py @@ -1,5 +1,6 @@ from fastapi import APIRouter, Depends from sqlalchemy.orm import Session +from sqlalchemy import text from datetime import datetime from app.db.session import get_db @@ -13,11 +14,12 @@ def health_check(db: Session = Depends(get_db)): """ try: # Check database connection - db.execute("SELECT 1") + db.execute(text("SELECT 1")) + db.commit() db_status = "healthy" except Exception as e: db_status = f"unhealthy: {str(e)}" - + return { "status": "healthy", "timestamp": datetime.utcnow(),