CREATE TABLE queryDeprecations ( id uuid primary key DEFAULT gen_random_uuid(), queryId uuid not null, time timestamp not null DEFAULT NOW(), removedAt timestamp, foreign key (queryId) references queries(id), unique (queryId, removedAt) );