Files
codex/codex-rs/state/migrations/0055_thread_attachments.sql
joeytrasatti-openai 9d88e9ae08 Rename thread artifacts to attachments in the state database (#43927)
## What changed

Add a migration that renames `thread_artifacts` to `thread_attachments` and
`artifact_type` to `attachment_type`, and recreates the thread lookup index
under the attachment name.

## Testing

Extend the migration test to verify that existing attachment data survives the
rename, section metadata is preserved, and the version 50 migrator tolerates
the updated database with `ignore_missing` enabled.

GitOrigin-RevId: 43955c4f69b91f92217efc1dc8e6a551d0716059
2026-09-08 22:02:55 +00:00

7 lines
298 B
SQL

ALTER TABLE thread_artifacts RENAME TO thread_attachments;
ALTER TABLE thread_attachments RENAME COLUMN artifact_type TO attachment_type;
DROP INDEX idx_thread_artifacts_thread_created_id;
CREATE INDEX idx_thread_attachments_thread_created_id
ON thread_attachments(thread_id, created_at, id);