2024-12-19 18:49:22 +00:00
|
|
|
CREATE TABLE results (
|
2025-02-07 12:12:51 +00:00
|
|
|
id uuid primary key DEFAULT uuid_generate_v7(),
|
2025-02-20 19:02:44 +00:00
|
|
|
textEntryId uuid not null,
|
2024-12-19 18:49:22 +00:00
|
|
|
queryId uuid not null,
|
2024-12-19 19:49:40 +00:00
|
|
|
value TEXT not null,
|
2024-12-19 18:49:22 +00:00
|
|
|
queryVersion int not null,
|
|
|
|
|
foreign key (queryId) references queries(id),
|
2025-02-20 19:02:44 +00:00
|
|
|
foreign key (textEntryId) references documentTextExtractions(id),
|
2025-02-14 18:43:26 +00:00
|
|
|
foreign key (queryId, queryVersion) references queryVersions(queryId, id)
|
2025-02-20 19:02:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE resultDependencies (
|
|
|
|
|
resultId uuid not null,
|
|
|
|
|
requiredResultId uuid not null,
|
|
|
|
|
foreign key (resultId) references results(id),
|
|
|
|
|
foreign key (requiredResultId) references results(id),
|
|
|
|
|
CONSTRAINT result_not_self_dependent CHECK (resultId != requiredResultId)
|
|
|
|
|
);
|