fix(claude-code): add missing Prisma migration for skill marketplaces

schema.prisma had the LiteLLM_SkillMarketplaceTable/marketplace_id/
allowed_skills additions but no committed migration captured them,
failing the schema_migration_check CI job.

Also fix ci_cd/run_migration.py: its temp migrations directory was a
fixed path at <repo_root>/migrations, colliding with the real tracked
migrations/ directory (Dockerfile, run.py) - running the script deleted
it via the cleanup step. Use a real tempdir instead.
This commit is contained in:
Krrish Dholakia 2026-07-11 19:44:37 -07:00
parent 5c8783a660
commit 66b6e8d06a
2 changed files with 37 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import re
import shutil
import subprocess
import sys
import tempfile
from datetime import datetime
from pathlib import Path
@ -235,8 +236,11 @@ def create_migration(
with testing.postgresql.Postgresql() as postgresql:
db_url = postgresql.url()
# Create temporary migrations directory next to schema.prisma
temp_migrations_dir = schema_path.parent / "migrations"
# A temp dir outside the repo, never a fixed path under root_dir -
# `root_dir / "migrations"` collides with the real, tracked
# top-level migrations/ directory (Dockerfile, run.py), and the
# rmtree in the `finally` block below would permanently delete it.
temp_migrations_dir = Path(tempfile.mkdtemp(prefix="litellm_migrations_")) / "migrations"
try:
# Copy existing migrations to temp directory

View file

@ -0,0 +1,31 @@
-- AlterTable
ALTER TABLE "LiteLLM_ClaudeCodePluginTable" ADD COLUMN "marketplace_id" TEXT;
-- AlterTable
ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "allowed_skills" TEXT[] DEFAULT ARRAY[]::TEXT[];
-- CreateTable
CREATE TABLE "LiteLLM_SkillMarketplaceTable" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"display_name" TEXT,
"source_type" TEXT NOT NULL,
"source_ref" TEXT,
"branch" TEXT DEFAULT 'main',
"owner_name" TEXT,
"owner_email" TEXT,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"sync_status" TEXT NOT NULL DEFAULT 'pending',
"sync_error" TEXT,
"skipped_count" INTEGER NOT NULL DEFAULT 0,
"last_synced_at" TIMESTAMP(3),
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
"created_by" TEXT,
CONSTRAINT "LiteLLM_SkillMarketplaceTable_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "LiteLLM_SkillMarketplaceTable_name_key" ON "LiteLLM_SkillMarketplaceTable"("name");