-- +goose Up ALTER TABLE attachment_jobs ADD COLUMN traceparent text, ADD COLUMN tracestate text; -- Pre-existing uploads lack a reliable acceptance/publication clock. Exclude them from SLI cohorts. ALTER TABLE attachments ADD COLUMN accepted_at timestamptz, ADD COLUMN first_ready_at timestamptz; CREATE INDEX attachments_accepted_idx ON attachments (accepted_at) WHERE accepted_at IS NOT NULL; CREATE INDEX attachment_jobs_queued_age_idx ON attachment_jobs (available_at) WHERE state='queued'; -- +goose Down DROP INDEX attachment_jobs_queued_age_idx; DROP INDEX attachments_accepted_idx; ALTER TABLE attachments DROP COLUMN first_ready_at, DROP COLUMN accepted_at; ALTER TABLE attachment_jobs DROP COLUMN tracestate, DROP COLUMN traceparent;