修复健康监控
This commit is contained in:
@@ -25,6 +25,7 @@ from .routers.v1 import (
|
||||
auth_router, user_router, todos_router,
|
||||
notes_router, tools_router, stats_router
|
||||
)
|
||||
from sqlalchemy import text
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -90,7 +91,8 @@ app.middleware("http")(log_requests)
|
||||
@app.get("/health")
|
||||
async def health_check(db: Session = Depends(get_db)):
|
||||
try:
|
||||
db.execute("SELECT 1")
|
||||
# 使用 text() 包裹 SQL 语句
|
||||
db.execute(text("SELECT 1"))
|
||||
return {
|
||||
"status": "healthy",
|
||||
"database": "connected",
|
||||
|
||||
Reference in New Issue
Block a user