Adds videos.transcript_status (NULL|none|fetched|rate_limited) and videos.rate_limited_at, so the runner can record a 429 and skip re-fetching a still-throttled video until a backoff window elapses. Columns inherit the existing videos RLS policy (migration 003); no policy change needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18 lines
989 B
SQL
18 lines
989 B
SQL
-- 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;
|