Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change IDs to GENERATE BY DEFAULT #15

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions db/schema.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE schema dict;

CREATE TABLE dict.dataset (
DATASET_ID INT GENERATED ALWAYS AS IDENTITY,
DATASET_ID INT GENERATED BY DEFAULT AS IDENTITY,
REF VARCHAR(512) NOT NULL,
FULL_NAME VARCHAR(512) NOT NULL,
ABBREVIATION VARCHAR(512) NOT NULL,
Expand All @@ -11,7 +11,7 @@ CREATE TABLE dict.dataset (
);

CREATE TABLE dict.dataset_meta (
DATASET_META_ID INT GENERATED ALWAYS AS IDENTITY,
DATASET_META_ID INT GENERATED BY DEFAULT AS IDENTITY,
DATASET_ID INT NOT NULL,
KEY VARCHAR(256) NOT NULL,
VALUE TEXT NOT NULL,
Expand All @@ -20,7 +20,7 @@ CREATE TABLE dict.dataset_meta (
);

CREATE TABLE dict.consent (
CONSENT_ID INT GENERATED ALWAYS AS IDENTITY,
CONSENT_ID INT GENERATED BY DEFAULT AS IDENTITY,
DATASET_ID INT NOT NULL,
CONSENT_CODE VARCHAR(512) NOT NULL,
DESCRIPTION VARCHAR(512) NOT NULL,
Expand All @@ -33,7 +33,7 @@ CREATE TABLE dict.consent (
);

CREATE TABLE dict.concept_node (
CONCEPT_NODE_ID INT GENERATED ALWAYS AS IDENTITY,
CONCEPT_NODE_ID INT GENERATED BY DEFAULT AS IDENTITY,
DATASET_ID INT NOT NULL,
NAME VARCHAR(512) NOT NULL,
DISPLAY VARCHAR(512) NOT NULL,
Expand All @@ -48,7 +48,7 @@ CREATE TABLE dict.concept_node (
CREATE UNIQUE INDEX concept_node_concept_path_idx ON dict.CONCEPT_NODE (md5(CONCEPT_PATH));

CREATE TABLE dict.concept_node_meta (
CONCEPT_NODE_META_ID INT GENERATED ALWAYS AS IDENTITY,
CONCEPT_NODE_META_ID INT GENERATED BY DEFAULT AS IDENTITY,
CONCEPT_NODE_ID INT NOT NULL,
KEY VARCHAR(256) NOT NULL,
VALUE TEXT NOT NULL,
Expand All @@ -57,7 +57,7 @@ CREATE TABLE dict.concept_node_meta (
CONSTRAINT fk_CONCEPT_NODE FOREIGN KEY (CONCEPT_NODE_ID) REFERENCES dict.CONCEPT_NODE(CONCEPT_NODE_ID)
);
CREATE TABLE dict.facet_category (
FACET_CATEGORY_ID INT GENERATED ALWAYS AS IDENTITY,
FACET_CATEGORY_ID INT GENERATED BY DEFAULT AS IDENTITY,
NAME VARCHAR(512) NOT NULL,
DISPLAY VARCHAR(512) NOT NULL,
DESCRIPTION TEXT DEFAULT '',
Expand All @@ -66,7 +66,7 @@ CREATE TABLE dict.facet_category (
);

CREATE TABLE dict.facet (
FACET_ID INT GENERATED ALWAYS AS IDENTITY,
FACET_ID INT GENERATED BY DEFAULT AS IDENTITY,
FACET_CATEGORY_ID INT NOT NULL,
NAME VARCHAR(512) NOT NULL,
DISPLAY VARCHAR(512) NOT NULL,
Expand All @@ -79,7 +79,7 @@ CREATE TABLE dict.facet (
);

CREATE TABLE dict.facet_meta (
FACET_META_ID INT GENERATED ALWAYS AS IDENTITY,
FACET_META_ID INT GENERATED BY DEFAULT AS IDENTITY,
FACET_ID INT NOT NULL,
KEY VARCHAR(256) NOT NULL,
VALUE TEXT NOT NULL,
Expand All @@ -88,7 +88,7 @@ CREATE TABLE dict.facet_meta (
);

CREATE TABLE dict.facet_category_meta (
FACET_CATEGORY_META_ID INT GENERATED ALWAYS AS IDENTITY,
FACET_CATEGORY_META_ID INT GENERATED BY DEFAULT AS IDENTITY,
FACET_CATEGORY_ID INT NOT NULL,
KEY VARCHAR(256) NOT NULL,
VALUE TEXT NOT NULL,
Expand All @@ -97,7 +97,7 @@ CREATE TABLE dict.facet_category_meta (
);

CREATE TABLE dict.facet__concept_node (
FACET__CONCEPT_NODE_ID INT GENERATED ALWAYS AS IDENTITY,
FACET__CONCEPT_NODE_ID INT GENERATED BY DEFAULT AS IDENTITY,
FACET_ID INT NOT NULL,
CONCEPT_NODE_ID INT NOT NULL,
PRIMARY KEY (FACET__CONCEPT_NODE_ID),
Expand All @@ -109,7 +109,7 @@ CREATE TABLE dict.facet__concept_node (
-- Commenting out because I don't remember what these do.

--CREATE TABLE dict.harmonized_concept_node (
-- HARMONIZED_CONCEPT_NODE_ID INT GENERATED ALWAYS AS IDENTITY,
-- 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',
Expand All @@ -120,7 +120,7 @@ CREATE TABLE dict.facet__concept_node (
--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 ALWAYS AS IDENTITY,
-- 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),
Expand Down