Fix database health check by adding commit after query execution

This commit is contained in:
Automated Action 2025-05-12 14:08:39 +00:00
parent 6705b7a5e2
commit 652f32404a

View File

@ -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,7 +14,8 @@ 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)}"