-- Migration 007: per-video transcript fetch status, for rate-limit backoff. -- -- transcript_status records the outcome of the last transcript attempt: -- NULL = not yet attempted -- 'none' = checked, no usable transcript (permanent — SourceNone) -- 'fetched' = transcript resolved and summarized (summary_id not null) -- 'rate_limited'= the caption endpoint returned 429; retry after a backoff window -- -- rate_limited_at stamps WHEN the 429 was seen, so the runner can skip re-fetching -- a still-throttled video until NOW() - rate_limited_at exceeds TAPIR_FETCH_BACKOFF. -- It is cleared (set NULL) whenever the status moves off 'rate_limited'. -- -- No RLS policy changes needed: videos already has ENABLE + FORCE ROW LEVEL -- SECURITY (migration 003) with the videos_isolation policy. New columns inherit -- that protection automatically. ALTER TABLE videos ADD COLUMN transcript_status TEXT; ALTER TABLE videos ADD COLUMN rate_limited_at TIMESTAMPTZ;