diff --git a/db/schema.sql b/db/schema.sql index ac0fa2f..877ce65 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -105,26 +105,14 @@ CREATE TABLE dict.facet__concept_node ( CONSTRAINT fk_facet FOREIGN KEY (FACET_ID) REFERENCES dict.facet(FACET_ID), CONSTRAINT fk_concept_node FOREIGN KEY (CONCEPT_NODE_ID) REFERENCES dict.concept_node(CONCEPT_NODE_ID) ); - --- Commenting out because I don't remember what these do. - ---CREATE TABLE dict.harmonized_concept_node ( --- HARMONIZED_CONCEPT_NODE_ID INT GENERATED BY DEFAULT AS IDENTITY, --- NAME VARCHAR(512) NOT NULL, --- DISPLAY VARCHAR(512) NOT NULL, --- CONCEPT_PATH VARCHAR(10000) NOT NULL DEFAULT 'INVALID', --- PARENT_ID INT, --- PRIMARY KEY (CONCEPT_NODE_ID), --- CONSTRAINT fk_parent FOREIGN KEY (PARENT_ID) REFERENCES harmonized_CONCEPT_NODE(CONCEPT_NODE_ID) ---); ---CREATE UNIQUE INDEX harmonized_concept_node_concept_path_idx ON harmonized_concept_node(md5(CONCEPT_PATH)); --- ---CREATE TABLE dict.harmonized_concept_node__concept_node ( --- HARMONIZED_CONCEPT_NODE__CONCEPT_NODE INT GENERATED BY DEFAULT AS IDENTITY, --- HARMONIZED_CONCEPT_NODE_ID INT NOT NULL, --- CONCEPT_NODE_ID INT NOT NULL, --- PRIMARY KEY (HARMONIZED_CONCEPT_NODE__CONCEPT_NODE), --- UNIQUE(HARMONIZED_CONCEPT_NODE_ID, CONCEPT_NODE_ID), --- CONSTRAINT fk_harmonized_CONCEPT_NODE FOREIGN KEY (HARMONIZED_CONCEPT_NODE_ID) REFERENCES harmonized_CONCEPT_NODE(HARMONIZED_CONCEPT_NODE_ID), --- CONSTRAINT fk_CONCEPT_NODE FOREIGN KEY (CONCEPT_NODE_ID) REFERENCES CONCEPT_NODE(CONCEPT_NODE_ID) ---); +CREATE TABLE IF NOT EXISTS dict.dataset_harmonization +( + dataset_harmonization_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY, + harmonized_dataset_id INT NOT NULL, + source_dataset_id INT NOT NULL, + UNIQUE (harmonized_dataset_id, source_dataset_id), + CONSTRAINT fk_harmonized_dataset_id FOREIGN KEY (harmonized_dataset_id) + REFERENCES dict.dataset (dataset_id), + CONSTRAINT fk_source_dataset_id FOREIGN KEY (source_dataset_id) + REFERENCES dict.dataset (dataset_id) +);