litellm/ci_cd/check_schema_sync.sh
Ishaan Jaffer 43b6faff4f ci: enforce schema.prisma sync across all copies
Add ci_cd/check_schema_sync.sh that diffs the three schema.prisma files
(repo root, litellm/proxy/, litellm-proxy-extras/) and exits non-zero if
any diverge. Wire it into the linting workflow and expose it as a
make check-schema-sync target (included in make lint).
2026-02-21 11:42:35 -08:00

37 lines
854 B
Bash
Executable file

#!/usr/bin/env bash
# check_schema_sync.sh
# Ensures all three copies of schema.prisma are identical.
# Exits non-zero if any differ.
set -euo pipefail
SOURCE="schema.prisma"
COPY1="litellm/proxy/schema.prisma"
COPY2="litellm-proxy-extras/litellm_proxy_extras/schema.prisma"
FAILED=0
diff_files() {
local a="$1"
local b="$2"
if ! diff -q "$a" "$b" > /dev/null 2>&1; then
echo "FAIL: $a and $b are out of sync."
diff "$a" "$b" || true
FAILED=1
else
echo "OK: $a and $b match."
fi
}
diff_files "$SOURCE" "$COPY1"
diff_files "$SOURCE" "$COPY2"
if [ "$FAILED" -ne 0 ]; then
echo ""
echo "schema.prisma files are out of sync. The source of truth is '$SOURCE'."
echo "Copy it to the other locations and commit the result."
exit 1
fi
echo ""
echo "All schema.prisma files are in sync."