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}"}