The previous approach resolved one idempotent migration per outer retry
attempt, exhausting all 5 retries when a DB had 4+ idempotent failures
(e.g., tables/columns already created by the old force-apply logic).
Now _deploy_with_idempotent_resolution loops internally: deploy → detect
idempotent P3009/P3018 → rollback + resolve → re-deploy, until all
idempotent migrations are resolved or a non-recoverable error is hit.
This keeps outer retries available for transient errors (timeouts, etc).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- P3009 idempotent path now re-runs prisma migrate deploy after resolving
the failed migration, so subsequent migrations are not left unapplied
- _mark_all_migrations_applied raises RuntimeError on unexpected errors
instead of silently swallowing them
- P3009 non-idempotent test now exercises the rollback-succeeds path
and verifies rollback was called
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- P3009 with unparseable migration name now fails fast instead of
silently falling through to the generic retry handler
- Removed --applied suggestion from RuntimeError message since it
skips running migration SQL and can leave schema inconsistent
- Increased retry attempts from 4 to 5
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `_resolve_all_migrations` method was generating a diff between the DB
and schema.prisma and force-applying it via `prisma db execute`, bypassing
migration tracking entirely. This caused schema thrashing during rolling
deployments when two versions with different schemas were running.
- Remove `_resolve_all_migrations` and its post-deploy "sanity check" call
- Replace with `_mark_all_migrations_applied` (marks only, no diff/apply)
- P3005 handler now uses `_mark_all_migrations_applied` + `prisma migrate deploy`
- P3009 non-idempotent errors now fail fast with actionable error messages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* build(litellm-proxy-extras/utils.py): correctly generate baseline migration for non-empty db
* fix(litellm-proxy-extras/utils.py): Fix issue in migration, where if a migration fails during baselining, all are still marked as applied
* fix(prisma_client.py): don't pass separate schema.prisma to litellm-proxy-extras
use the one in litellm-proxy-extras
* fix(litellm-proxy-extras/utils.py): support passing custom dir for baselining db in read-only fs
Fixes https://github.com/BerriAI/litellm/issues/9885
* fix(utils.py): give helpful warning message when permission denied error raised in fs