Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(policy_engine): make priority migration idempotent

Devin AI1b1f6ada4674
diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260917055603_add_policy_attachment_priority/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260917055603_add_policy_attachment_priority/migration.sql
index 7838c23df4e..5efe5f6a72e 100644
--- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260917055603_add_policy_attachment_priority/migration.sql
+++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260917055603_add_policy_attachment_priority/migration.sql
@@ -1 +1 @@
-ALTER TABLE "LiteLLM_PolicyAttachmentTable" ADD COLUMN "priority" INTEGER;
+ALTER TABLE "LiteLLM_PolicyAttachmentTable" ADD COLUMN IF NOT EXISTS "priority" INTEGER;
diff --git a/litellm/proxy/_lazy_openapi_snapshot.json b/litellm/proxy/_lazy_openapi_snapshot.json
index 74f38b3ca6d..341e787a1b1 100644
--- a/litellm/proxy/_lazy_openapi_snapshot.json
+++ b/litellm/proxy/_lazy_openapi_snapshot.json
@@ -33929,6 +33929,18 @@
"title": "Policy Name",
"type": "string"
},
+ "priority": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Explicit execution order, lower runs first. Prioritised attachments run before those without one.",
+ "title": "Priority"
+ },
"scope": {
"anyOf": [
{
@@ -34042,6 +34054,18 @@
"title": "Policy Name",
"type": "string"
},
+ "priority": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Explicit execution order, lower runs first. Prioritised attachments run before those without one.",
+ "title": "Priority"
+ },
"scope": {
"anyOf": [
{
@@ -36062,6 +36086,18 @@
"title": "Policy Name",
"type": "string"
},
+ "priority": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Explicit execution order, lower runs first. Prioritised attachments run before those without one.",
+ "title": "Priority"
+ },
"scope": {
"anyOf": [
{
diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts
index 872875cc535..2027e8ab5a1 100644
--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts
+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts
@@ -34487,6 +34487,11 @@ export interface components {
* @description Name of the policy to attach.
*/
policy_name: string;
+ /**
+ * Priority
+ * @description Explicit execution order, lower runs first. Prioritised attachments run before those without one.
+ */
+ priority?: number | null;
/**
* Scope
* @description Use '*' for global scope (applies to all requests).
@@ -34545,6 +34550,11 @@ export interface components {
* @description Name of the attached policy.
*/
policy_name: string;
+ /**
+ * Priority
+ * @description Explicit execution order, lower runs first. Prioritised attachments run before those without one.
+ */
+ priority?: number | null;
/**
* Scope
* @description Scope of the attachment.