molecule-core/platform/migrations/021_delegation_idempotency.up.sql
Hongming Wang 24fec62d7f initial commit — Molecule AI platform
Forked clean from public hackathon repo (Starfire-AgentTeam, BSL 1.1)
with full rebrand to Molecule AI under github.com/Molecule-AI/molecule-monorepo.

Brand: Starfire → Molecule AI.
Slug: starfire / agent-molecule → molecule.
Env vars: STARFIRE_* → MOLECULE_*.
Go module: github.com/agent-molecule/platform → github.com/Molecule-AI/molecule-monorepo/platform.
Python packages: starfire_plugin → molecule_plugin, starfire_agent → molecule_agent.
DB: agentmolecule → molecule.

History truncated; see public repo for prior commits and contributor
attribution. Verified green: go test -race ./... (platform), pytest
(workspace-template 1129 + sdk 132), vitest (canvas 352), build (mcp).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:55:37 -07:00

16 lines
626 B
SQL

-- #124 — delegation idempotency.
--
-- Adds an optional idempotency_key column on activity_logs so callers
-- (notably agents that may retry after a container-restart race) can
-- safely re-issue the same delegation without producing duplicate work.
--
-- The unique index is partial — only enforced for non-NULL keys so the
-- column is fully backwards compatible with existing rows.
ALTER TABLE activity_logs
ADD COLUMN IF NOT EXISTS idempotency_key TEXT;
CREATE UNIQUE INDEX IF NOT EXISTS activity_logs_idempotency_uniq
ON activity_logs (workspace_id, idempotency_key)
WHERE idempotency_key IS NOT NULL;