CREATE TABLE results (
    id uuid primary key,
    queryId uuid not null,
    documentId uuid not null,
    value TEXT,
    cleanVersion int not null,
    textVersion int not null,
    queryVersion int not null,
    foreign key (queryId) references queries(id),
    unique (queryId, documentId, cleanVersion, textVersion, queryVersion)
);