Skip to content

Commit a53ecd5

Browse files
Krrish Dholakiaclaude
andcommitted
fix: replace --skip_db_migration_check with --enforce_prisma_migration_check
Flip the default behavior: database migration failures now warn and continue by default. Only when --enforce_prisma_migration_check (or ENFORCE_PRISMA_MIGRATION_CHECK=true) is explicitly set will the proxy exit on migration failure. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 80b131f commit a53ecd5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

litellm/proxy/proxy_cli.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,11 @@ def _maybe_setup_prometheus_multiproc_dir(
557557
envvar="MAX_REQUESTS_BEFORE_RESTART",
558558
)
559559
@click.option(
560-
"--skip_db_migration_check",
560+
"--enforce_prisma_migration_check",
561561
is_flag=True,
562562
default=False,
563-
help="Warn and continue instead of exiting when database migration fails.",
564-
envvar="SKIP_DB_MIGRATION_CHECK",
563+
help="Exit with error if database migration fails on startup.",
564+
envvar="ENFORCE_PRISMA_MIGRATION_CHECK",
565565
)
566566
def run_server( # noqa: PLR0915
567567
host,
@@ -602,7 +602,7 @@ def run_server( # noqa: PLR0915
602602
skip_server_startup,
603603
keepalive_timeout,
604604
max_requests_before_restart,
605-
skip_db_migration_check: bool,
605+
enforce_prisma_migration_check: bool,
606606
):
607607
args = locals()
608608
if local:
@@ -868,18 +868,17 @@ def run_server( # noqa: PLR0915
868868
if not PrismaManager.setup_database(
869869
use_migrate=not use_prisma_db_push
870870
):
871-
if skip_db_migration_check:
871+
if enforce_prisma_migration_check:
872872
print( # noqa
873-
"\033[1;33mLiteLLM Proxy: Database migration failed but continuing startup "
874-
"because --skip_db_migration_check is set.\033[0m"
873+
"\033[1;31mLiteLLM Proxy: Database setup failed after multiple retries. "
874+
"The proxy cannot start safely. Please check your database connection and migration status.\033[0m"
875875
)
876+
sys.exit(1)
876877
else:
877878
print( # noqa
878-
"\033[1;31mLiteLLM Proxy: Database setup failed after multiple retries. "
879-
"The proxy cannot start safely. Please check your database connection and migration status. "
880-
"Pass --skip_db_migration_check or set SKIP_DB_MIGRATION_CHECK=true to warn and continue instead of exiting.\033[0m"
879+
"\033[1;33mLiteLLM Proxy: Database migration failed but continuing startup. "
880+
"Set --enforce_prisma_migration_check or ENFORCE_PRISMA_MIGRATION_CHECK=true to exit on failure.\033[0m"
881881
)
882-
sys.exit(1)
883882
else:
884883
print( # noqa
885884
f"Unable to connect to DB. DATABASE_URL found in environment, but prisma package not found." # noqa

0 commit comments

Comments
 (0)