CREATE TABLE IF NOT EXISTS results (
    task_id        TEXT PRIMARY KEY,
    filename       TEXT,
    transcription  TEXT,
    analysis       JSONB,
    tagging        JSONB,
    metadata       JSONB,
    status         TEXT NOT NULL DEFAULT 'pending',
    created_at     TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at     TIMESTAMPTZ NOT NULL DEFAULT now()
);

ALTER TABLE results ADD COLUMN IF NOT EXISTS metadata JSONB;
