5b7160fe44
Job Collector * createstructure * mostupdatevalidation * repocollectorupdate * updateoutline * updatevalidation * scriptupdate * cleanupdockerignore * update * collectorupdateapi
29 lines
899 B
SQL
29 lines
899 B
SQL
CREATE TYPE queryType AS ENUM ('context_full', 'json_extractor');
|
|
|
|
CREATE TABLE queries (
|
|
id uuid primary key DEFAULT gen_random_uuid(),
|
|
latestVersion int not null default 1,
|
|
activeVersion int not null default 1,
|
|
type queryType not null
|
|
);
|
|
|
|
CREATE TABLE requiredQueries (
|
|
id uuid primary key DEFAULT gen_random_uuid(),
|
|
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)
|
|
);
|
|
|
|
CREATE TABLE queryConfigs (
|
|
id uuid primary key DEFAULT gen_random_uuid(),
|
|
queryId uuid not null,
|
|
config jsonb not null,
|
|
addedVersion int not null,
|
|
removedVersion int,
|
|
foreign key (queryId) references queries(id),
|
|
unique (queryId, removedVersion)
|
|
); |