CREATE TABLE transcription_block_versions (
    id         UUID      PRIMARY KEY DEFAULT gen_random_uuid(),
    block_id   UUID      NOT NULL REFERENCES transcription_blocks(id) ON DELETE CASCADE,
    text       TEXT      NOT NULL,
    changed_by UUID      REFERENCES users(id) ON DELETE SET NULL,
    changed_at TIMESTAMP NOT NULL DEFAULT now()
);

CREATE INDEX idx_tbv_block ON transcription_block_versions(block_id, changed_at DESC);
