-- Word-level timings per transcript segment (Otter-parity Wave 1 foundation).
-- The worker already returns per-word {w,s,e} inside each segment; ingest has
-- been writing them to disk (transcript_words.json) and never surfacing them.
-- One row per segment keeps rows small and lets the viewer lazy-fetch only
-- what it needs: word hover, click-a-word-to-seek, and the anchor model for
-- highlights/comments/edits (seg_index + word span).
-- Live PG < 9.5: plain CREATE INDEX. Also folded into 2026_07_13_meetings_combined.sql.

CREATE TABLE IF NOT EXISTS meeting_words (
    meeting_id varchar(32) NOT NULL,
    seg_index  integer     NOT NULL,
    company    varchar(32) NOT NULL,
    words_json text        NOT NULL,   -- [{w,s,e}] for this segment, seconds
    created    timestamp   NOT NULL DEFAULT now(),
    PRIMARY KEY (meeting_id, seg_index)
);

CREATE INDEX idx_mw_company ON meeting_words (company);
