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

DB_0.34 #603

Merged
merged 3 commits into from
Oct 19, 2021
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
2 changes: 1 addition & 1 deletion database/src/migrations/20210225205948_biohub_release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';
const DB_USER_API_PASS = process.env.DB_USER_API_PASS;
const DB_USER_API = process.env.DB_USER_API;

const DB_RELEASE = 'release.0.33';
const DB_RELEASE = 'release.0.34';

/**
* Apply biohub release changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- ER/Studio Data Architect SQL Code Generation
-- Project : BioHub.DM1
--
-- Date Created : Tuesday, October 12, 2021 13:51:48
-- Date Created : Tuesday, October 19, 2021 11:05:37
-- Target DBMS : PostgreSQL 10.x-12.x
--

Expand Down Expand Up @@ -679,6 +679,7 @@ CREATE TABLE occurrence(
occurrence_submission_id integer NOT NULL,
taxonid varchar(3000),
lifestage varchar(3000),
sex varchar(3000),
vernacularname varchar(3000),
eventdate TIMESTAMPTZ NOT NULL,
individualcount varchar(3000),
Expand Down Expand Up @@ -706,6 +707,8 @@ COMMENT ON COLUMN occurrence.taxonid IS 'A string representation of the value pr
;
COMMENT ON COLUMN occurrence.lifestage IS 'A string representation of the value provided for the given Darwin Core term.'
;
COMMENT ON COLUMN occurrence.sex IS 'A string representation of the value provided for the given Darwin Core term.'
;
COMMENT ON COLUMN occurrence.vernacularname IS 'A string representation of the value provided for the given Darwin Core term.'
;
COMMENT ON COLUMN occurrence.eventdate IS 'A datetime representation of the value provided for the given Darwin Core term.'
Expand Down Expand Up @@ -3312,16 +3315,16 @@ CREATE INDEX "Ref185170" ON occurrence_data_package(data_package_id)
CREATE INDEX "Ref169174" ON occurrence_data_package(occurrence_id)
;
--
-- INDEX: "Ref153160"
-- INDEX: "Ref192188"
--

CREATE INDEX "Ref153160" ON occurrence_submission(survey_id)
CREATE INDEX "Ref192188" ON occurrence_submission(template_methodology_species_id)
;
--
-- INDEX: "Ref192188"
-- INDEX: "Ref153160"
--

CREATE INDEX "Ref192188" ON occurrence_submission(template_methodology_species_id)
CREATE INDEX "Ref153160" ON occurrence_submission(survey_id)
;
--
-- INDEX: occurrence_submission_data_package_uk1
Expand Down Expand Up @@ -3678,16 +3681,16 @@ CREATE UNIQUE INDEX summary_submission_message_type_nuk1 ON summary_submission_m
CREATE INDEX "Ref215206" ON summary_submission_message_type(summary_submission_message_class_id)
;
--
-- INDEX: "Ref45147"
-- INDEX: "Ref190190"
--

CREATE INDEX "Ref45147" ON survey(project_id)
CREATE INDEX "Ref190190" ON survey(common_survey_methodology_id)
;
--
-- INDEX: "Ref190190"
-- INDEX: "Ref45147"
--

CREATE INDEX "Ref190190" ON survey(common_survey_methodology_id)
CREATE INDEX "Ref45147" ON survey(project_id)
;
--
-- INDEX: "Ref153168"
Expand Down Expand Up @@ -3971,16 +3974,16 @@ ALTER TABLE occurrence_data_package ADD CONSTRAINT "Refoccurrence174"
-- TABLE: occurrence_submission
--

ALTER TABLE occurrence_submission ADD CONSTRAINT "Refsurvey160"
FOREIGN KEY (survey_id)
REFERENCES survey(survey_id)
;

ALTER TABLE occurrence_submission ADD CONSTRAINT "Reftemplate_methodology_species188"
FOREIGN KEY (template_methodology_species_id)
REFERENCES template_methodology_species(template_methodology_species_id)
;

ALTER TABLE occurrence_submission ADD CONSTRAINT "Refsurvey160"
FOREIGN KEY (survey_id)
REFERENCES survey(survey_id)
;


--
-- TABLE: occurrence_submission_data_package
Expand Down Expand Up @@ -4266,16 +4269,16 @@ ALTER TABLE summary_submission_message_type ADD CONSTRAINT "Refsummary_submissio
-- TABLE: survey
--

ALTER TABLE survey ADD CONSTRAINT "Refproject147"
FOREIGN KEY (project_id)
REFERENCES project(project_id)
;

ALTER TABLE survey ADD CONSTRAINT "Refcommon_survey_methodology190"
FOREIGN KEY (common_survey_methodology_id)
REFERENCES common_survey_methodology(common_survey_methodology_id)
;

ALTER TABLE survey ADD CONSTRAINT "Refproject147"
FOREIGN KEY (project_id)
REFERENCES project(project_id)
;


--
-- TABLE: survey_attachment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ begin
insert into occurrence_submission (survey_id, source, event_timestamp) values (_survey_id, 'BIOHUB BATCH', now()-interval '1 day') returning occurrence_submission_id into _occurrence_submission_id;
select count(1) into _count from occurrence_submission;
assert _count = 1, 'FAIL occurrence_submission';
insert into occurrence (occurrence_submission_id, taxonid, lifestage, eventdate) values (_occurrence_submission_id, 'M-ALAL', 'Adult', now()-interval '10 day');
insert into occurrence (occurrence_submission_id, taxonid, lifestage, eventdate, sex) values (_occurrence_submission_id, 'M-ALAL', 'Adult', now()-interval '10 day', 'male');
select count(1) into _count from occurrence;
assert _count = 1, 'FAIL occurrence';
insert into submission_status (occurrence_submission_id, submission_status_type_id, event_timestamp) values (_occurrence_submission_id, (select submission_status_type_id from submission_status_type where name = 'Submitted'), now()-interval '1 day') returning submission_status_id into _submission_status_id;
Expand All @@ -166,7 +166,7 @@ begin
insert into occurrence_submission (survey_id, source, event_timestamp) values (_survey_id, 'BIOHUB BATCH', now()) returning occurrence_submission_id into _occurrence_submission_id;
select count(1) into _count from occurrence_submission;
assert _count = 2, 'FAIL occurrence_submission';
insert into occurrence (occurrence_submission_id, taxonid, lifestage, eventdate) values (_occurrence_submission_id, 'M-ALAL', 'Adult', now()-interval '5 day');
insert into occurrence (occurrence_submission_id, taxonid, lifestage, eventdate, sex) values (_occurrence_submission_id, 'M-ALAL', 'Adult', now()-interval '5 day', 'female');
select count(1) into _count from occurrence;
assert _count = 2, 'FAIL occurrence';
insert into submission_status (occurrence_submission_id, submission_status_type_id, event_timestamp) values (_occurrence_submission_id, (select submission_status_type_id from submission_status_type where name = 'Submitted'), now()) returning submission_status_id into _submission_status_id;
Expand Down