fix(backend): Add migrations to fix credentials inputs with invalid provider "llm" (vol. 3)

Fix User table reference in raw SQL queryin non-Prisma migration
This commit is contained in:
Reinier van der Leer
2024-11-15 20:56:04 +01:00
parent 2a66295a92
commit 29688758c4

View File

@@ -547,17 +547,17 @@ async def fix_llm_provider_credentials():
broken_nodes = await prisma.get_client().query_raw(
"""
SELECT user.id user_id,
SELECT "User".id user_id,
node.id node_id,
node."constantInput" node_preset_input
FROM platform."AgentGraph" graph
LEFT JOIN platform."AgentNode" node
ON node."agentGraphId" = graph.id
LEFT JOIN platform."User" user
ON graph."userId" = user.id
LEFT JOIN platform."User"
ON graph."userId" = "User".id
WHERE node."constantInput"::jsonb->'credentials'->>'provider' = 'llm'
ORDER BY user_id;
"""
ORDER BY user_id;
"""
)
logger.info(f"Fixing LLM credential inputs on {len(broken_nodes)} nodes")