From 541bb88847ba135762420ffe46b0cb4167a0e568 Mon Sep 17 00:00:00 2001 From: Martin Hohenberg Date: Thu, 18 Jun 2026 21:37:02 +0200 Subject: [PATCH] Catch migration exceptions so app doesn't crash-loop on startup Co-Authored-By: Claude Sonnet 4.6 --- app/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index b02bce4..f8a1dc8 100644 --- a/app/main.py +++ b/app/main.py @@ -15,7 +15,10 @@ async def lifespan(app: FastAPI): ok, msg = check_db() if ok: logger.info("Database connection OK") - run_migrations() + try: + run_migrations() + except Exception: + logger.exception("Migration failed — app will start but DB schema may be out of date") else: logger.warning("Database unreachable: %s", msg) yield