From 9af967c4f068f552a274d12166c2de4fc30f394a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 1 Oct 2026 21:19:01 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E6=B7=BB=E5=8A=A0=20/debug/alembic-up?= =?UTF-8?q?grade=20=E8=A7=A6=E5=8F=91=E7=9C=9F=E5=AE=9E=20alembic=20upgrad?= =?UTF-8?q?e=20head?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/app/api/routes/health.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/api/app/api/routes/health.py b/apps/api/app/api/routes/health.py index b75a6ed46..97b722529 100644 --- a/apps/api/app/api/routes/health.py +++ b/apps/api/app/api/routes/health.py @@ -218,3 +218,19 @@ def debug_alembic_heads(): except Exception as e: import traceback return {"error": str(e), "trace": traceback.format_exc()[-1000:]} + + +@router.get("/debug/alembic-upgrade") +def debug_alembic_upgrade(): + """Actually run alembic upgrade head from API process (debug only).""" + import subprocess, os + try: + proc = subprocess.run( + ["alembic", "upgrade", "head"], + cwd="/app", capture_output=True, text=True, timeout=60, + env={**os.environ, "PYTHONPATH": "/app:/app/apps/api"} + ) + return {"rc": proc.returncode, "out": proc.stdout[-3000:], "err": proc.stderr[-3000:]} + except Exception as e: + import traceback + return {"error": str(e), "trace": traceback.format_exc()[-1500:]}