CREATE TABLE requiredQueries (
    id uuid primary key,
    queryId uuid not null,
    requiredQueryId uuid not null,
    addedVersion int not null,
    removedVersion int,
    foreign key (queryId) references queries(id),
    foreign key (requiredQueryId) references queries(id),
    unique (queryId, requiredQueryId, removedVersion)
);