Skip to content

Prisma Migrate - support setting custom migration dir #10336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 26, 2025

Conversation

krrishdholakia
Copy link
Contributor

@krrishdholakia krrishdholakia commented Apr 26, 2025

Title

Prisma Migrate - support setting custom migration dir - LITELLM_MIGRATION_DIR

Relevant issues

Fixes #10076, where an error during migration would still lead to all migrations being considered applied
Fixes #9885, where baselining db was not possible in read-only FS

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on (make test-unit)[https://docs.litellm.ai/docs/extras/contributing_code]
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

  • Sets 0_init sql to be the current state of db
  • Creates new {datetime}_migration_diff sql for difference between the current db and schema.prisma
  • Executes the diff via prisma db execute + marks all migrations as resolved
  • Supports new LITELLM_MIGRATION_DIR env var - allows user to set custom folder path for migrations (expectation: folder is writable)
  • Copies pkg migration dir contents in there, and runs migration from there.

Copy link

vercel bot commented Apr 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2025 6:18pm

@krrishdholakia krrishdholakia merged commit 93b6df9 into main Apr 26, 2025
41 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Prisma Migrate order Implement baseline db logic in litellm-proxy-extras
1 participant