Catch migration exceptions so app doesn't crash-loop on startup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user