Files
codex/codex-rs/state/migrations/0051_thread_artifacts.sql
joeytrasatti-openai 9b2ef38f54 Add persisted thread artifact models (#40509)
## What changed

- Add a `thread_artifacts` SQLite table with per-thread typed identities,
  JSON payloads, cascade deletion, uniqueness enforcement, and an index for
  ordered per-thread reads.
- Export artifact records, attachment and removal outcomes, and paginated
  result models from `codex-state`.

## Testing

- Add a migration test covering preservation of existing thread-section
  metadata and compatibility with the previous migration set.

GitOrigin-RevId: 4e0a8e5bfa168ae2b8871970466e5055e142a4a6
2026-08-25 01:10:10 +00:00

13 lines
412 B
SQL

CREATE TABLE thread_artifacts (
id TEXT PRIMARY KEY,
thread_id TEXT NOT NULL REFERENCES threads(id) ON DELETE CASCADE,
artifact_type TEXT NOT NULL,
identity_key TEXT NOT NULL,
payload TEXT NOT NULL,
created_at INTEGER NOT NULL,
UNIQUE (thread_id, artifact_type, identity_key)
);
CREATE INDEX idx_thread_artifacts_thread_created_id
ON thread_artifacts(thread_id, created_at, id);