diff --git a/.github/workflows/test-rust-db.yml b/.github/workflows/test-rust-db.yml index bb88b593d5b..87fe7bae02b 100644 --- a/.github/workflows/test-rust-db.yml +++ b/.github/workflows/test-rust-db.yml @@ -93,7 +93,9 @@ jobs: - name: Deploy Prisma migrations working-directory: . - run: uv run --no-sync prisma migrate deploy --schema litellm-proxy-extras/litellm_proxy_extras/schema.prisma + run: | + uv run --no-sync python -m litellm_proxy_extras.migration_sources /tmp/litellm-prisma + uv run --no-sync prisma migrate deploy --schema /tmp/litellm-prisma/schema.prisma - name: Install SQLx CLI run: cargo install sqlx-cli --version 0.9.0 --locked --no-default-features -F postgres diff --git a/litellm-proxy-extras/litellm_proxy_extras/migration_sources.py b/litellm-proxy-extras/litellm_proxy_extras/migration_sources.py index 4d75a7fc8d3..8277d236bcd 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migration_sources.py +++ b/litellm-proxy-extras/litellm_proxy_extras/migration_sources.py @@ -1,4 +1,5 @@ import shutil +import sys from itertools import chain from pathlib import Path from typing import Final @@ -26,3 +27,7 @@ def materialize_prisma_dir(target: Path) -> Path: for migration in shipped_migrations(): shutil.copytree(migration, migrations / migration.name, dirs_exist_ok=True) return target + + +if __name__ == "__main__": + sys.stdout.write(f"{materialize_prisma_dir(Path(sys.argv[1]))}\n") diff --git a/litellm-proxy-extras/migration_runbook.md b/litellm-proxy-extras/migration_runbook.md index 9ab6db74cde..a11d77d6e0d 100644 --- a/litellm-proxy-extras/migration_runbook.md +++ b/litellm-proxy-extras/migration_runbook.md @@ -132,4 +132,4 @@ Migrations are split across two source folders that the proxy merges into one fl - `litellm_proxy_extras/migrations/` for every table except `LiteLLM_SpendLogs` - `litellm_proxy_extras/spend_logs/migrations/` for any migration whose SQL mentions `LiteLLM_SpendLogs`, next to `spend_logs/LiteLLM_SpendLogs.prisma` (a copy of the model block in `schema.prisma`) and `spend_logs/request_log_indexes.py` -The split exists so `spend_logs/` can carry its own `.github/CODEOWNERS` entry. `ci_cd/run_migration.py` picks the folder from the generated SQL, and `tests/code_coverage_tests/check_spend_logs_folder.py` (part of the required `lint passed` check) fails a migration outside `spend_logs/` that mentions the table, or a `LiteLLM_SpendLogs.prisma` copy that drifted from `schema.prisma`. Directory names and apply order are unchanged by the split, so `_prisma_migrations` rows keep matching. +The split exists so `spend_logs/` can carry its own `.github/CODEOWNERS` entry. `ci_cd/run_migration.py` picks the folder from the generated SQL, and `tests/code_coverage_tests/check_spend_logs_folder.py` (part of the required `lint passed` check) fails a migration outside `spend_logs/` that mentions the table, or a `LiteLLM_SpendLogs.prisma` copy that drifted from `schema.prisma`. Directory names and apply order are unchanged by the split, so `_prisma_migrations` rows keep matching. To run the Prisma CLI by hand against the shipped migrations, write the merged directory first with `python -m litellm_proxy_extras.migration_sources /tmp/litellm-prisma` and pass `--schema /tmp/litellm-prisma/schema.prisma`; pointing `prisma migrate deploy` straight at the package directory only sees the shared folder.