-- 004_traceparent.sql — carry the trace across the queue.
--
-- A trace is a chain of span contexts. `POST /v1/instances` commits a row and returns;
-- a worker in another pod claims that row minutes later. Nothing propagates the context
-- across that gap, because the gap is a table. So the context rides in the table: the API
-- writes the W3C traceparent it is currently inside, and the worker extracts it at claim
-- and makes its span a child of the API's. Skip this and Tempo shows two unrelated traces
-- for one provision, which is worse than no tracing — it looks like it works.
--
-- Nullable, no default, no backfill: expand/contract done right. Old rows have no
-- traceparent and never will; a worker running the previous image ignores a column it has
-- never heard of. Migrate first, deploy second, and neither step needs the other to have
-- happened.

alter table tasks add column traceparent text;   -- '00-<32 hex>-<16 hex>-01', null = untraced
