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

Member Node ID Revisions Schema Change #1681

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions src/upgrade-db-to-3.0.0-postgres.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Create the node_id_revisions table
*/
CREATE SEQUENCE node_id_revision_id_seq;
CREATE TABLE node_id_revisions (
node_id_revision_id INTEGER default nextval ('node_id_revision_id_seq'), -- unique identifier for
-- this node_id revision
node_id TEXT NOT NULL, -- DataONE nodeId being persisted; eg: urn:node:TestBROOKE
is_most_recent BOOLEAN, -- TRUE if this is the most recent known value
date_created TIMESTAMP NOT NULL, -- the datetime on which this node_id_revision was created
CONSTRAINT node_id_revisions_pk PRIMARY KEY (node_id_revision_id)
);


/*
* update the database version
*/
UPDATE db_version SET status=0;

INSERT INTO db_version (version, status, date_created)
VALUES ('3.0.0', 1, CURRENT_DATE);
15 changes: 14 additions & 1 deletion src/xmltables-postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ CREATE TABLE quota_usage_events (
node_id text, -- the id of the node which host the usage
quota_subject text, -- the subject of the quota
quota_type text, -- the type of the quota
requestor text, -- the requestor of the qutao usage
requestor text, -- the requester of the quota usage
CONSTRAINT quota_usage_events_pk PRIMARY KEY (usage_local_id),
CONSTRAINT quota_usage_events_uk1 UNIQUE (quota_id, instance_id, status),
CONSTRAINT quota_usage_events_uk2 UNIQUE (quota_subject, quota_type, instance_id, status)
Expand All @@ -595,3 +595,16 @@ CREATE INDEX quota_usage_events_idx5 ON quota_usage_events (usage_remote_id);
CREATE INDEX quota_usage_events_idx6 ON quota_usage_events (quota_subject);
CREATE INDEX quota_usage_events_idx7 ON quota_usage_events (requestor);
CREATE INDEX quota_usage_events_idx8 ON quota_usage_events (quota_type);

/*
* Create the node_id_revisions table
*/
CREATE SEQUENCE node_id_revision_id_seq;
CREATE TABLE node_id_revisions (
node_id_revision_id INTEGER default nextval ('node_id_revision_id_seq'), -- unique identifier for
-- this node_id revision
node_id TEXT NOT NULL, -- DataONE nodeId being persisted; eg: urn:node:TestBROOKE
is_most_recent BOOLEAN, -- TRUE if this is the most recent known value
date_created TIMESTAMP NOT NULL, -- the datetime on which this node_id_revision was created
CONSTRAINT node_id_revisions_pk PRIMARY KEY (node_id_revision_id)
);