You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): index ai_messages.execution_id and give ai_sessions.execution_id a foreign key
ai_messages.execution_id had an ON DELETE SET NULL foreign key but no index, so
deleting an execution (cascaded from a finding delete) scanned the table to
null it — and the agent-trace viewer reads a finding's turns by execution.
ai_sessions.execution_id had neither, so it could dangle after an execution
delete. Both now carry the FK (SET NULL / NO ACTION, matching the execution
table's own relations) and an index. The two session↔execution relations are
named so Prisma can tell the execution that opened a session apart from the
session an execution records once it completes.
The speculative ix_ai_message_workspace_turnkind_time is dropped: metering
still groups by `kind`, and nothing in the stack queries by turnKind yet. The
unmerged migration is edited in place.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DXLChvn8HPA42wsuDUFYo
0 commit comments