mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: only fail hard on diff application error when marking all as applied
The _resolve_all_migrations sanity check path (mark_all_applied=False) should warn on diff failure, not crash. Only the P3005 baselining path (mark_all_applied=True) should fail hard to prevent marking all migrations as applied when the diff wasn't applied. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7cec62ab0a
commit
7cc27a72cd
1 changed files with 19 additions and 13 deletions
|
|
@ -325,20 +325,26 @@ class ProxyExtrasDBManager:
|
|||
logger.info(f"prisma db execute stdout: {result.stdout}")
|
||||
logger.info("✅ Migration diff applied successfully")
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error(
|
||||
f"Failed to apply migration diff: {e.stderr}. "
|
||||
f"Will NOT mark migrations as applied."
|
||||
)
|
||||
raise RuntimeError(
|
||||
f"Migration diff application failed. Migrations will not be marked as applied. "
|
||||
f"Please check the database state and apply the diff manually. Error: {e.stderr}"
|
||||
) from e
|
||||
if mark_all_applied:
|
||||
logger.error(
|
||||
f"Failed to apply migration diff: {e.stderr}. "
|
||||
f"Will NOT mark migrations as applied."
|
||||
)
|
||||
raise RuntimeError(
|
||||
f"Migration diff application failed. Migrations will not be marked as applied. "
|
||||
f"Please check the database state and apply the diff manually. Error: {e.stderr}"
|
||||
) from e
|
||||
else:
|
||||
logger.warning(f"Failed to apply migration diff: {e.stderr}")
|
||||
except subprocess.TimeoutExpired:
|
||||
logger.error("Migration diff application timed out. Will NOT mark migrations as applied.")
|
||||
raise RuntimeError(
|
||||
"Migration diff application timed out. Migrations will not be marked as applied. "
|
||||
"Please check the database state and apply the diff manually."
|
||||
)
|
||||
if mark_all_applied:
|
||||
logger.error("Migration diff application timed out. Will NOT mark migrations as applied.")
|
||||
raise RuntimeError(
|
||||
"Migration diff application timed out. Migrations will not be marked as applied. "
|
||||
"Please check the database state and apply the diff manually."
|
||||
)
|
||||
else:
|
||||
logger.warning("Migration diff application timed out.")
|
||||
|
||||
# 3. Mark all migrations as applied
|
||||
if not mark_all_applied:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue