fix(ci): deploy the merged migration dir in the rust db-queries job

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
kerry 2026-10-27 00:24:35 +00:00
parent 9aa242dabf
commit cd8a2a577c
3 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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")

View file

@ -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.