Commit graph

8 commits

Author SHA1 Message Date
yuneng-jiang
d41e5e29ce Extract _deploy_with_idempotent_resolution loop for P3009/P3018
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>
2026-03-12 11:29:42 -07:00
yuneng-jiang
347090d288 Fix P3009 idempotent re-deploy, error propagation, and test coverage
- 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>
2026-03-12 11:21:16 -07:00
yuneng-jiang
06b12ad985 Fix P3009 unmatched-regex fallthrough and remediation message
- 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>
2026-03-12 11:10:02 -07:00
yuneng-jiang
d4e30a9119 Remove dangerous schema diff force-apply from Prisma migration startup
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>
2026-03-12 11:03:11 -07:00
Harshit Jain
fd2f148161
fix: resolve 'does not exist' migration errors as applied in setup_database (#19281) 2026-01-26 22:11:36 -08:00
Harshit Jain
22000f3beb
fix: add case-insensitive support for guardrail mode and actions (#19480) 2026-01-21 20:52:57 -08:00
yuya_matsuba
262fb742d2
Fix: Distinguish permission errors from idempotent errors in Prisma migrations (#17064)
* fix: distinguish permission errors from idempotent errors in Prisma migrations

* style: apply Black formatting and fix line length issues
2025-11-24 20:41:44 -08:00
Krish Dholakia
93b6df96e0
Prisma Migrate - support setting custom migration dir (#10336)
* 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
2025-04-26 12:05:06 -07:00