From 0ad5647d362223b1cb4bfbb0ab51fcb1d53f217d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 1 Oct 2026 20:32:47 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E4=B8=B4=E6=97=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20/debug/viral-columns=20=E7=AB=AF=E7=82=B9=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=88=97=E4=BF=A1=E6=81=AF=EF=BC=88staging=E6=8E=92=E9=9A=9C?= =?UTF-8?q?=E5=90=8E=E5=88=A0=E9=99=A4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/app/api/routes/health.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/api/app/api/routes/health.py b/apps/api/app/api/routes/health.py index cd436df6a..e22c59eee 100644 --- a/apps/api/app/api/routes/health.py +++ b/apps/api/app/api/routes/health.py @@ -137,3 +137,21 @@ async def _check_migrations() -> dict: return {"status": "unhealthy", "message": f"Missing tables, found {count}/5"} except Exception as error: return {"status": "unhealthy", "message": f"Migration check failed: {error}"} + + + +@router.get("/debug/viral-columns") +def debug_viral_columns(): + """Temporary debug: inspect viral_video_jobs columns + alembic_version.""" + try: + conn = psycopg.connect(settings.DATABASE_URL, connect_timeout=3) + with conn.cursor() as cur: + cur.execute("SELECT column_name FROM information_schema.columns WHERE table_schema='public' AND table_name='viral_video_jobs' ORDER BY ordinal_position") + cols = [r[0] for r in cur.fetchall()] + cur.execute("SELECT version_num FROM alembic_version") + row = cur.fetchone() + version = row[0] if row else None + conn.close() + return {"columns": cols, "alembic_version": version, "count": len(cols)} + except Exception as e: + return {"error": f"{type(e).__name__}: {e}"}