diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260516210000_add_access_group_membership/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260516210000_add_access_group_membership/migration.sql new file mode 100644 index 00000000000..3ce733ddd0c --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260516210000_add_access_group_membership/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE IF NOT EXISTS "LiteLLM_AccessGroupMembership" ( + "id" TEXT NOT NULL, + "parent_group" TEXT NOT NULL, + "child_group" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "LiteLLM_AccessGroupMembership_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_AccessGroupMembership_parent_group_child_group_key" ON "LiteLLM_AccessGroupMembership"("parent_group", "child_group"); + +-- CreateIndex +CREATE INDEX IF NOT EXISTS "LiteLLM_AccessGroupMembership_parent_group_idx" ON "LiteLLM_AccessGroupMembership"("parent_group"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index b53507abe6a..219fd9ccbf8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -1375,3 +1375,17 @@ model LiteLLM_WorkflowMessage { @@unique([run_id, sequence_number]) @@index([run_id]) } + +// Parent/child relationships between access groups. Used by +// _get_models_from_access_groups to expand a parent group into its +// transitively-included models. Resolution is depth-first with a +// visited set; cyclic edges are logged and skipped at read time. +model LiteLLM_AccessGroupMembership { + id String @id @default(uuid()) + parent_group String + child_group String + created_at DateTime @default(now()) + + @@unique([parent_group, child_group]) + @@index([parent_group]) +} diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index b53507abe6a..219fd9ccbf8 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -1375,3 +1375,17 @@ model LiteLLM_WorkflowMessage { @@unique([run_id, sequence_number]) @@index([run_id]) } + +// Parent/child relationships between access groups. Used by +// _get_models_from_access_groups to expand a parent group into its +// transitively-included models. Resolution is depth-first with a +// visited set; cyclic edges are logged and skipped at read time. +model LiteLLM_AccessGroupMembership { + id String @id @default(uuid()) + parent_group String + child_group String + created_at DateTime @default(now()) + + @@unique([parent_group, child_group]) + @@index([parent_group]) +} diff --git a/schema.prisma b/schema.prisma index b53507abe6a..219fd9ccbf8 100644 --- a/schema.prisma +++ b/schema.prisma @@ -1375,3 +1375,17 @@ model LiteLLM_WorkflowMessage { @@unique([run_id, sequence_number]) @@index([run_id]) } + +// Parent/child relationships between access groups. Used by +// _get_models_from_access_groups to expand a parent group into its +// transitively-included models. Resolution is depth-first with a +// visited set; cyclic edges are logged and skipped at read time. +model LiteLLM_AccessGroupMembership { + id String @id @default(uuid()) + parent_group String + child_group String + created_at DateTime @default(now()) + + @@unique([parent_group, child_group]) + @@index([parent_group]) +}