-- Rename agent_invocations.skill_key -> call_key
-- (词义对齐:Anthropic Agent Skills 是另一回事 — md 文件 + 渐进式披露;
--  我们这里只是"一次 LLM 调用配方",改名 call_key 避免混淆。)

-- Drop old indexes that reference skill_key
DROP INDEX IF EXISTS "agent_invocations_skill_key_prompt_version_started_at_idx";
DROP INDEX IF EXISTS "agent_invocations_eval_mode_skill_key_idx";

-- Rename column
ALTER TABLE "agent_invocations" RENAME COLUMN "skill_key" TO "call_key";

-- Recreate indexes with new column name
CREATE INDEX "agent_invocations_call_key_prompt_version_started_at_idx"
  ON "agent_invocations"("call_key", "prompt_version", "started_at");
CREATE INDEX "agent_invocations_eval_mode_call_key_idx"
  ON "agent_invocations"("eval_mode", "call_key");
