Revision 5953
Added by Aaron Marcuse-Kubitza over 11 years ago
vegbien.sql | ||
---|---|---|
476 | 476 |
|
477 | 477 |
|
478 | 478 |
-- |
479 |
-- Name: party_creator_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
479 |
-- Name: party_reference_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
480 | 480 |
-- |
481 | 481 |
|
482 |
CREATE FUNCTION party_creator_id_self_ref() RETURNS trigger
|
|
482 |
CREATE FUNCTION party_reference_id_self_ref() RETURNS trigger
|
|
483 | 483 |
LANGUAGE plpgsql |
484 | 484 |
AS $$ |
485 | 485 |
BEGIN |
486 | 486 |
IF new.party_id IS NULL THEN -- prepopulate party_id |
487 | 487 |
new.party_id = nextval('party_party_id_seq'::regclass); |
488 | 488 |
END IF; |
489 |
IF new.creator_id = 0 THEN -- make self-reference
|
|
490 |
new.creator_id = new.party_id;
|
|
489 |
IF new.reference_id = 0 THEN -- make self-reference
|
|
490 |
new.reference_id = new.party_id;
|
|
491 | 491 |
END IF; |
492 | 492 |
RETURN new; |
493 | 493 |
END; |
... | ... | |
697 | 697 |
|
698 | 698 |
CREATE TABLE taxonlabel ( |
699 | 699 |
taxonlabel_id integer NOT NULL, |
700 |
creator_id integer NOT NULL,
|
|
700 |
reference_id integer NOT NULL,
|
|
701 | 701 |
sourceaccessioncode text, |
702 | 702 |
creationdate date, |
703 | 703 |
taxonstatus taxonomic_status, |
... | ... | |
728 | 728 |
|
729 | 729 |
|
730 | 730 |
-- |
731 |
-- Name: COLUMN taxonlabel.creator_id; Type: COMMENT; Schema: public; Owner: -
|
|
731 |
-- Name: COLUMN taxonlabel.reference_id; Type: COMMENT; Schema: public; Owner: -
|
|
732 | 732 |
-- |
733 | 733 |
|
734 |
COMMENT ON COLUMN taxonlabel.creator_id IS 'The entity that created the taxon label.';
|
|
734 |
COMMENT ON COLUMN taxonlabel.reference_id IS 'The entity that created the taxon label.';
|
|
735 | 735 |
|
736 | 736 |
|
737 | 737 |
-- |
... | ... | |
999 | 999 |
|
1000 | 1000 |
CREATE TABLE aggregateoccurrence ( |
1001 | 1001 |
aggregateoccurrence_id integer NOT NULL, |
1002 |
creator_id integer NOT NULL,
|
|
1002 |
reference_id integer NOT NULL,
|
|
1003 | 1003 |
sourceaccessioncode text, |
1004 | 1004 |
taxonoccurrence_id integer, |
1005 | 1005 |
collectiondate date, |
... | ... | |
1143 | 1143 |
|
1144 | 1144 |
CREATE TABLE coordinates ( |
1145 | 1145 |
coordinates_id integer NOT NULL, |
1146 |
creator_id integer NOT NULL,
|
|
1146 |
reference_id integer NOT NULL,
|
|
1147 | 1147 |
latitude_deg double precision NOT NULL, |
1148 | 1148 |
longitude_deg double precision NOT NULL, |
1149 | 1149 |
verbatimlatitude text, |
... | ... | |
1174 | 1174 |
|
1175 | 1175 |
CREATE TABLE location ( |
1176 | 1176 |
location_id integer NOT NULL, |
1177 |
creator_id integer NOT NULL,
|
|
1177 |
reference_id integer NOT NULL,
|
|
1178 | 1178 |
sourceaccessioncode text, |
1179 | 1179 |
parent_id integer, |
1180 | 1180 |
authorlocationcode text, |
... | ... | |
1233 | 1233 |
|
1234 | 1234 |
CREATE TABLE locationevent ( |
1235 | 1235 |
locationevent_id integer NOT NULL, |
1236 |
creator_id integer NOT NULL,
|
|
1236 |
reference_id integer NOT NULL,
|
|
1237 | 1237 |
sourceaccessioncode text, |
1238 | 1238 |
parent_id integer, |
1239 | 1239 |
location_id integer, |
... | ... | |
1533 | 1533 |
|
1534 | 1534 |
CREATE TABLE party ( |
1535 | 1535 |
party_id integer NOT NULL, |
1536 |
creator_id integer NOT NULL,
|
|
1536 |
reference_id integer NOT NULL,
|
|
1537 | 1537 |
fullname text, |
1538 | 1538 |
salutation text, |
1539 | 1539 |
givenname text, |
... | ... | |
1547 | 1547 |
partypublic boolean DEFAULT true, |
1548 | 1548 |
d_obscount integer, |
1549 | 1549 |
accessioncode text, |
1550 |
CONSTRAINT party_required_key CHECK (((organizationname IS NOT NULL) OR ((creator_id <> party_id) AND ((fullname IS NOT NULL) OR (surname IS NOT NULL)))))
|
|
1550 |
CONSTRAINT party_required_key CHECK (((organizationname IS NOT NULL) OR ((reference_id <> party_id) AND ((fullname IS NOT NULL) OR (surname IS NOT NULL)))))
|
|
1551 | 1551 |
); |
1552 | 1552 |
|
1553 | 1553 |
|
... | ... | |
1557 | 1557 |
|
1558 | 1558 |
CREATE TABLE place ( |
1559 | 1559 |
place_id integer NOT NULL, |
1560 |
creator_id integer NOT NULL,
|
|
1560 |
reference_id integer NOT NULL,
|
|
1561 | 1561 |
placecode text, |
1562 | 1562 |
matched_place_id integer, |
1563 | 1563 |
coordinates_id integer, |
... | ... | |
1598 | 1598 |
|
1599 | 1599 |
CREATE TABLE plantobservation ( |
1600 | 1600 |
plantobservation_id integer NOT NULL, |
1601 |
creator_id integer NOT NULL,
|
|
1601 |
reference_id integer NOT NULL,
|
|
1602 | 1602 |
sourceaccessioncode text, |
1603 | 1603 |
aggregateoccurrence_id integer, |
1604 | 1604 |
overallheight_m double precision, |
... | ... | |
1631 | 1631 |
|
1632 | 1632 |
CREATE TABLE specimenreplicate ( |
1633 | 1633 |
specimenreplicate_id integer NOT NULL, |
1634 |
creator_id integer NOT NULL,
|
|
1634 |
reference_id integer NOT NULL,
|
|
1635 | 1635 |
sourceaccessioncode text, |
1636 | 1636 |
plantobservation_id integer, |
1637 | 1637 |
institution_id integer, |
... | ... | |
1671 | 1671 |
|
1672 | 1672 |
CREATE TABLE stemobservation ( |
1673 | 1673 |
stemobservation_id integer NOT NULL, |
1674 |
creator_id integer NOT NULL,
|
|
1674 |
reference_id integer NOT NULL,
|
|
1675 | 1675 |
sourceaccessioncode text, |
1676 | 1676 |
plantobservation_id integer NOT NULL, |
1677 | 1677 |
authorstemcode text, |
... | ... | |
1744 | 1744 |
|
1745 | 1745 |
CREATE TABLE taxonoccurrence ( |
1746 | 1746 |
taxonoccurrence_id integer NOT NULL, |
1747 |
creator_id integer NOT NULL,
|
|
1747 |
reference_id integer NOT NULL,
|
|
1748 | 1748 |
sourceaccessioncode text, |
1749 | 1749 |
locationevent_id integer, |
1750 | 1750 |
authortaxoncode text, |
... | ... | |
1877 | 1877 |
-- |
1878 | 1878 |
|
1879 | 1879 |
CREATE VIEW analytical_stem_view AS |
1880 |
SELECT datasource.organizationname AS "institutionCode", place.country, place.stateprovince AS "stateProvince", place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude", location.sourceaccessioncode AS "plotName", location.elevation_m AS "elevationInMeters", _m2_to_ha(location.area_m2) AS "plotArea_ha", method.name AS "samplingProtocol", aggregateoccurrence.collectiondate AS "dateCollected", accepted_taxonverbatim.family, accepted_taxonverbatim.genus, ((accepted_taxonverbatim.genus || ' '::text) || accepted_taxonverbatim.specific_epithet) AS "speciesBinomial", COALESCE(accepted_taxonverbatim.taxonomicname, accepted_taxonverbatim.taxonname) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonlabel.taxonomicname, parsed_taxonverbatim.morphospecies], ' '::text), ''::text) AS "scientificNameWithMorphospecies", NULLIF(array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text), ''::text) AS "identifiedBy", taxonoccurrence.growthform AS "growthForm", taxonoccurrence.iscultivated AS cultivated, taxonoccurrence.cultivatedbasis AS "cultivatedBasis", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.verbatimcollectorname AS "recordedBy", plantobservation.collectionnumber AS "recordNumber" FROM (((((((((((((((((((party datasource JOIN location ON ((location.creator_id = datasource.party_id))) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place USING (place_id)) LEFT JOIN coordinates USING (coordinates_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonverbatim datasource_taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) JOIN taxonlabel parsed_taxonlabel ON ((parsed_taxonlabel.taxonlabel_id = datasource_taxonlabel.matched_label_id))) LEFT JOIN taxonverbatim parsed_taxonverbatim ON ((parsed_taxonverbatim.taxonlabel_id = parsed_taxonlabel.taxonlabel_id))) JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) JOIN taxonverbatim accepted_taxonverbatim ON ((accepted_taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN stemobservation USING (plantobservation_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)) WHERE ((datasource.creator_id = datasource.party_id) AND (NOT taxondetermination.isoriginal));
|
|
1880 |
SELECT datasource.organizationname AS "institutionCode", place.country, place.stateprovince AS "stateProvince", place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude", location.sourceaccessioncode AS "plotName", location.elevation_m AS "elevationInMeters", _m2_to_ha(location.area_m2) AS "plotArea_ha", method.name AS "samplingProtocol", aggregateoccurrence.collectiondate AS "dateCollected", accepted_taxonverbatim.family, accepted_taxonverbatim.genus, ((accepted_taxonverbatim.genus || ' '::text) || accepted_taxonverbatim.specific_epithet) AS "speciesBinomial", COALESCE(accepted_taxonverbatim.taxonomicname, accepted_taxonverbatim.taxonname) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonlabel.taxonomicname, parsed_taxonverbatim.morphospecies], ' '::text), ''::text) AS "scientificNameWithMorphospecies", NULLIF(array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text), ''::text) AS "identifiedBy", taxonoccurrence.growthform AS "growthForm", taxonoccurrence.iscultivated AS cultivated, taxonoccurrence.cultivatedbasis AS "cultivatedBasis", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.verbatimcollectorname AS "recordedBy", plantobservation.collectionnumber AS "recordNumber" FROM (((((((((((((((((((party datasource JOIN location ON ((location.reference_id = datasource.party_id))) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place USING (place_id)) LEFT JOIN coordinates USING (coordinates_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonverbatim datasource_taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) JOIN taxonlabel parsed_taxonlabel ON ((parsed_taxonlabel.taxonlabel_id = datasource_taxonlabel.matched_label_id))) LEFT JOIN taxonverbatim parsed_taxonverbatim ON ((parsed_taxonverbatim.taxonlabel_id = parsed_taxonlabel.taxonlabel_id))) JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) JOIN taxonverbatim accepted_taxonverbatim ON ((accepted_taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN stemobservation USING (plantobservation_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)) WHERE ((datasource.reference_id = datasource.party_id) AND (NOT taxondetermination.isoriginal));
|
|
1881 | 1881 |
|
1882 | 1882 |
|
1883 | 1883 |
-- |
... | ... | |
2870 | 2870 |
|
2871 | 2871 |
CREATE TABLE project ( |
2872 | 2872 |
project_id integer NOT NULL, |
2873 |
creator_id integer NOT NULL,
|
|
2873 |
reference_id integer NOT NULL,
|
|
2874 | 2874 |
sourceaccessioncode text, |
2875 | 2875 |
projectname text, |
2876 | 2876 |
projectdescription text, |
... | ... | |
4507 | 4507 |
-- |
4508 | 4508 |
|
4509 | 4509 |
ALTER TABLE ONLY project |
4510 |
ADD CONSTRAINT project_unique UNIQUE (creator_id, projectname);
|
|
4510 |
ADD CONSTRAINT project_unique UNIQUE (reference_id, projectname);
|
|
4511 | 4511 |
|
4512 | 4512 |
|
4513 | 4513 |
-- |
... | ... | |
4784 | 4784 |
-- Name: aggregateoccurrence_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4785 | 4785 |
-- |
4786 | 4786 |
|
4787 |
CREATE UNIQUE INDEX aggregateoccurrence_unique_within_creator ON aggregateoccurrence USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4787 |
CREATE UNIQUE INDEX aggregateoccurrence_unique_within_creator ON aggregateoccurrence USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4788 | 4788 |
|
4789 | 4789 |
|
4790 | 4790 |
-- |
... | ... | |
4819 | 4819 |
-- Name: coordinates_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4820 | 4820 |
-- |
4821 | 4821 |
|
4822 |
CREATE UNIQUE INDEX coordinates_unique ON coordinates USING btree (creator_id, latitude_deg, longitude_deg, (COALESCE(verbatimlatitude, '\\N'::text)), (COALESCE(verbatimlongitude, '\\N'::text)), (COALESCE(verbatimcoordinates, '\\N'::text)), (COALESCE(footprintgeometry_dwc, '\\N'::text)));
|
|
4822 |
CREATE UNIQUE INDEX coordinates_unique ON coordinates USING btree (reference_id, latitude_deg, longitude_deg, (COALESCE(verbatimlatitude, '\\N'::text)), (COALESCE(verbatimlongitude, '\\N'::text)), (COALESCE(verbatimcoordinates, '\\N'::text)), (COALESCE(footprintgeometry_dwc, '\\N'::text)));
|
|
4823 | 4823 |
|
4824 | 4824 |
|
4825 | 4825 |
-- |
... | ... | |
4847 | 4847 |
-- Name: location_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4848 | 4848 |
-- |
4849 | 4849 |
|
4850 |
CREATE INDEX location_creator ON location USING btree (creator_id);
|
|
4850 |
CREATE INDEX location_creator ON location USING btree (reference_id);
|
|
4851 | 4851 |
|
4852 | 4852 |
|
4853 | 4853 |
-- |
... | ... | |
4861 | 4861 |
-- Name: location_unique_within_creator_by_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4862 | 4862 |
-- |
4863 | 4863 |
|
4864 |
CREATE UNIQUE INDEX location_unique_within_creator_by_authorlocationcode ON location USING btree (creator_id, (COALESCE(authorlocationcode, '\\N'::text))) WHERE (((authorlocationcode IS NOT NULL) AND (parent_id IS NULL)) AND (sourceaccessioncode IS NULL));
|
|
4864 |
CREATE UNIQUE INDEX location_unique_within_creator_by_authorlocationcode ON location USING btree (reference_id, (COALESCE(authorlocationcode, '\\N'::text))) WHERE (((authorlocationcode IS NOT NULL) AND (parent_id IS NULL)) AND (sourceaccessioncode IS NULL));
|
|
4865 | 4865 |
|
4866 | 4866 |
|
4867 | 4867 |
-- |
4868 | 4868 |
-- Name: location_unique_within_creator_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4869 | 4869 |
-- |
4870 | 4870 |
|
4871 |
CREATE UNIQUE INDEX location_unique_within_creator_by_sourceaccessioncode ON location USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4871 |
CREATE UNIQUE INDEX location_unique_within_creator_by_sourceaccessioncode ON location USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4872 | 4872 |
|
4873 | 4873 |
|
4874 | 4874 |
-- |
... | ... | |
4896 | 4896 |
-- Name: locationevent_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4897 | 4897 |
-- |
4898 | 4898 |
|
4899 |
CREATE UNIQUE INDEX locationevent_unique_within_creator ON locationevent USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4899 |
CREATE UNIQUE INDEX locationevent_unique_within_creator ON locationevent USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4900 | 4900 |
|
4901 | 4901 |
|
4902 | 4902 |
-- |
... | ... | |
4973 | 4973 |
-- Name: party_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4974 | 4974 |
-- |
4975 | 4975 |
|
4976 |
CREATE UNIQUE INDEX party_unique ON party USING btree (creator_id, (COALESCE(organizationname, '\\N'::text)), (COALESCE(fullname, '\\N'::text)), (COALESCE(surname, '\\N'::text)), (COALESCE(givenname, '\\N'::text)), (COALESCE(middlename, '\\N'::text)));
|
|
4976 |
CREATE UNIQUE INDEX party_unique ON party USING btree (reference_id, (COALESCE(organizationname, '\\N'::text)), (COALESCE(fullname, '\\N'::text)), (COALESCE(surname, '\\N'::text)), (COALESCE(givenname, '\\N'::text)), (COALESCE(middlename, '\\N'::text)));
|
|
4977 | 4977 |
|
4978 | 4978 |
|
4979 | 4979 |
-- |
4980 | 4980 |
-- Name: place_unique_within_creator_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4981 | 4981 |
-- |
4982 | 4982 |
|
4983 |
CREATE UNIQUE INDEX place_unique_within_creator_by_code ON place USING btree (creator_id, (COALESCE(placecode, '\\N'::text))) WHERE (placecode IS NOT NULL);
|
|
4983 |
CREATE UNIQUE INDEX place_unique_within_creator_by_code ON place USING btree (reference_id, (COALESCE(placecode, '\\N'::text))) WHERE (placecode IS NOT NULL);
|
|
4984 | 4984 |
|
4985 | 4985 |
|
4986 | 4986 |
-- |
4987 | 4987 |
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4988 | 4988 |
-- |
4989 | 4989 |
|
4990 |
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (creator_id, (COALESCE(continent, '\\N'::text)), (COALESCE(country, '\\N'::text)), (COALESCE(stateprovince, '\\N'::text)), (COALESCE(county, '\\N'::text)), (COALESCE(coordinates_id, 2147483647))) WHERE (placecode IS NULL);
|
|
4990 |
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (reference_id, (COALESCE(continent, '\\N'::text)), (COALESCE(country, '\\N'::text)), (COALESCE(stateprovince, '\\N'::text)), (COALESCE(county, '\\N'::text)), (COALESCE(coordinates_id, 2147483647))) WHERE (placecode IS NULL);
|
|
4991 | 4991 |
|
4992 | 4992 |
|
4993 | 4993 |
-- |
... | ... | |
5008 | 5008 |
-- Name: plantobservation_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5009 | 5009 |
-- |
5010 | 5010 |
|
5011 |
CREATE UNIQUE INDEX plantobservation_unique_within_creator ON plantobservation USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5011 |
CREATE UNIQUE INDEX plantobservation_unique_within_creator ON plantobservation USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5012 | 5012 |
|
5013 | 5013 |
|
5014 | 5014 |
-- |
... | ... | |
5022 | 5022 |
-- Name: project_unique_name_date; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5023 | 5023 |
-- |
5024 | 5024 |
|
5025 |
CREATE UNIQUE INDEX project_unique_name_date ON project USING btree (creator_id, (COALESCE(projectname, '\\N'::text)), (COALESCE(startdate, 'infinity'::date))) WHERE (sourceaccessioncode IS NULL);
|
|
5025 |
CREATE UNIQUE INDEX project_unique_name_date ON project USING btree (reference_id, (COALESCE(projectname, '\\N'::text)), (COALESCE(startdate, 'infinity'::date))) WHERE (sourceaccessioncode IS NULL);
|
|
5026 | 5026 |
|
5027 | 5027 |
|
5028 | 5028 |
-- |
5029 | 5029 |
-- Name: project_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5030 | 5030 |
-- |
5031 | 5031 |
|
5032 |
CREATE UNIQUE INDEX project_unique_within_creator ON project USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5032 |
CREATE UNIQUE INDEX project_unique_within_creator ON project USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5033 | 5033 |
|
5034 | 5034 |
|
5035 | 5035 |
-- |
... | ... | |
5085 | 5085 |
-- Name: specimenreplicate_unique_catalognumber; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5086 | 5086 |
-- |
5087 | 5087 |
|
5088 |
CREATE UNIQUE INDEX specimenreplicate_unique_catalognumber ON specimenreplicate USING btree (creator_id, (COALESCE(institution_id, 2147483647)), (COALESCE(collectioncode_dwc, '\\N'::text)), (COALESCE(catalognumber_dwc, '\\N'::text)), (COALESCE(plantobservation_id, 2147483647))) WHERE ((catalognumber_dwc IS NOT NULL) AND (sourceaccessioncode IS NULL));
|
|
5088 |
CREATE UNIQUE INDEX specimenreplicate_unique_catalognumber ON specimenreplicate USING btree (reference_id, (COALESCE(institution_id, 2147483647)), (COALESCE(collectioncode_dwc, '\\N'::text)), (COALESCE(catalognumber_dwc, '\\N'::text)), (COALESCE(plantobservation_id, 2147483647))) WHERE ((catalognumber_dwc IS NOT NULL) AND (sourceaccessioncode IS NULL));
|
|
5089 | 5089 |
|
5090 | 5090 |
|
5091 | 5091 |
-- |
5092 | 5092 |
-- Name: specimenreplicate_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5093 | 5093 |
-- |
5094 | 5094 |
|
5095 |
CREATE UNIQUE INDEX specimenreplicate_unique_within_creator ON specimenreplicate USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5095 |
CREATE UNIQUE INDEX specimenreplicate_unique_within_creator ON specimenreplicate USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5096 | 5096 |
|
5097 | 5097 |
|
5098 | 5098 |
-- |
... | ... | |
5113 | 5113 |
-- Name: stemobservation_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5114 | 5114 |
-- |
5115 | 5115 |
|
5116 |
CREATE UNIQUE INDEX stemobservation_unique_within_creator ON stemobservation USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5116 |
CREATE UNIQUE INDEX stemobservation_unique_within_creator ON stemobservation USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5117 | 5117 |
|
5118 | 5118 |
|
5119 | 5119 |
-- |
... | ... | |
5141 | 5141 |
-- Name: taxonlabel_0_unique_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5142 | 5142 |
-- |
5143 | 5143 |
|
5144 |
CREATE UNIQUE INDEX taxonlabel_0_unique_identifying_name ON taxonlabel USING btree (creator_id, (COALESCE(taxonomicname, '\\N'::text))) WHERE (taxonomicname IS NOT NULL);
|
|
5144 |
CREATE UNIQUE INDEX taxonlabel_0_unique_identifying_name ON taxonlabel USING btree (reference_id, (COALESCE(taxonomicname, '\\N'::text))) WHERE (taxonomicname IS NOT NULL);
|
|
5145 | 5145 |
|
5146 | 5146 |
|
5147 | 5147 |
-- |
5148 | 5148 |
-- Name: taxonlabel_1_unique_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5149 | 5149 |
-- |
5150 | 5150 |
|
5151 |
CREATE UNIQUE INDEX taxonlabel_1_unique_sourceaccessioncode ON taxonlabel USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5151 |
CREATE UNIQUE INDEX taxonlabel_1_unique_sourceaccessioncode ON taxonlabel USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5152 | 5152 |
|
5153 | 5153 |
|
5154 | 5154 |
-- |
... | ... | |
5176 | 5176 |
-- Name: taxonlabel_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5177 | 5177 |
-- |
5178 | 5178 |
|
5179 |
CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)));
|
|
5179 |
CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), reference_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)));
|
|
5180 | 5180 |
|
5181 | 5181 |
|
5182 | 5182 |
-- |
... | ... | |
5197 | 5197 |
-- Name: taxonoccurrence_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5198 | 5198 |
-- |
5199 | 5199 |
|
5200 |
CREATE UNIQUE INDEX taxonoccurrence_unique_within_creator ON taxonoccurrence USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5200 |
CREATE UNIQUE INDEX taxonoccurrence_unique_within_creator ON taxonoccurrence USING btree (reference_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
5201 | 5201 |
|
5202 | 5202 |
|
5203 | 5203 |
-- |
... | ... | |
5222 | 5222 |
|
5223 | 5223 |
|
5224 | 5224 |
-- |
5225 |
-- Name: party_creator_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
5225 |
-- Name: party_reference_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
5226 | 5226 |
-- |
5227 | 5227 |
|
5228 |
CREATE TRIGGER party_creator_id_self_ref BEFORE INSERT OR UPDATE ON party FOR EACH ROW EXECUTE PROCEDURE party_creator_id_self_ref();
|
|
5228 |
CREATE TRIGGER party_reference_id_self_ref BEFORE INSERT OR UPDATE ON party FOR EACH ROW EXECUTE PROCEDURE party_reference_id_self_ref();
|
|
5229 | 5229 |
|
5230 | 5230 |
|
5231 | 5231 |
-- |
... | ... | |
5323 | 5323 |
|
5324 | 5324 |
|
5325 | 5325 |
-- |
5326 |
-- Name: aggregateoccurrence_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5326 |
-- Name: aggregateoccurrence_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5327 | 5327 |
-- |
5328 | 5328 |
|
5329 | 5329 |
ALTER TABLE ONLY aggregateoccurrence |
5330 |
ADD CONSTRAINT aggregateoccurrence_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5330 |
ADD CONSTRAINT aggregateoccurrence_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5331 | 5331 |
|
5332 | 5332 |
|
5333 | 5333 |
-- |
5334 |
-- Name: aggregateoccurrence_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5334 |
-- Name: aggregateoccurrence_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5335 | 5335 |
-- |
5336 | 5336 |
|
5337 | 5337 |
ALTER TABLE ONLY aggregateoccurrence |
5338 |
ADD CONSTRAINT aggregateoccurrence_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5338 |
ADD CONSTRAINT aggregateoccurrence_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5339 | 5339 |
|
5340 | 5340 |
|
5341 | 5341 |
-- |
... | ... | |
5531 | 5531 |
|
5532 | 5532 |
|
5533 | 5533 |
-- |
5534 |
-- Name: coordinates_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5534 |
-- Name: coordinates_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5535 | 5535 |
-- |
5536 | 5536 |
|
5537 | 5537 |
ALTER TABLE ONLY coordinates |
5538 |
ADD CONSTRAINT coordinates_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5538 |
ADD CONSTRAINT coordinates_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5539 | 5539 |
|
5540 | 5540 |
|
5541 | 5541 |
-- |
... | ... | |
5579 | 5579 |
|
5580 | 5580 |
|
5581 | 5581 |
-- |
5582 |
-- Name: location_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5583 |
-- |
|
5584 |
|
|
5585 |
ALTER TABLE ONLY location |
|
5586 |
ADD CONSTRAINT location_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5587 |
|
|
5588 |
|
|
5589 |
-- |
|
5590 | 5582 |
-- Name: location_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
5591 | 5583 |
-- |
5592 | 5584 |
|
... | ... | |
5595 | 5587 |
|
5596 | 5588 |
|
5597 | 5589 |
-- |
5598 |
-- Name: locationevent_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5590 |
-- Name: location_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5599 | 5591 |
-- |
5600 | 5592 |
|
5601 |
ALTER TABLE ONLY locationevent
|
|
5602 |
ADD CONSTRAINT locationevent_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5593 |
ALTER TABLE ONLY location |
|
5594 |
ADD CONSTRAINT location_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5603 | 5595 |
|
5604 | 5596 |
|
5605 | 5597 |
-- |
... | ... | |
5643 | 5635 |
|
5644 | 5636 |
|
5645 | 5637 |
-- |
5638 |
-- Name: locationevent_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5639 |
-- |
|
5640 |
|
|
5641 |
ALTER TABLE ONLY locationevent |
|
5642 |
ADD CONSTRAINT locationevent_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5643 |
|
|
5644 |
|
|
5645 |
-- |
|
5646 | 5646 |
-- Name: locationevent_soiltaxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
5647 | 5647 |
-- |
5648 | 5648 |
|
... | ... | |
5779 | 5779 |
|
5780 | 5780 |
|
5781 | 5781 |
-- |
5782 |
-- Name: party_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5782 |
-- Name: party_currentname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5783 | 5783 |
-- |
5784 | 5784 |
|
5785 | 5785 |
ALTER TABLE ONLY party |
5786 |
ADD CONSTRAINT party_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5786 |
ADD CONSTRAINT party_currentname_id_fkey FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5787 | 5787 |
|
5788 | 5788 |
|
5789 | 5789 |
-- |
5790 |
-- Name: party_currentname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5790 |
-- Name: party_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5791 | 5791 |
-- |
5792 | 5792 |
|
5793 | 5793 |
ALTER TABLE ONLY party |
5794 |
ADD CONSTRAINT party_currentname_id_fkey FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5794 |
ADD CONSTRAINT party_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5795 | 5795 |
|
5796 | 5796 |
|
5797 | 5797 |
-- |
... | ... | |
5819 | 5819 |
|
5820 | 5820 |
|
5821 | 5821 |
-- |
5822 |
-- Name: place_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5822 |
-- Name: place_matched_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5823 | 5823 |
-- |
5824 | 5824 |
|
5825 | 5825 |
ALTER TABLE ONLY place |
5826 |
ADD CONSTRAINT place_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5826 |
ADD CONSTRAINT place_matched_place_id_fkey FOREIGN KEY (matched_place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5827 | 5827 |
|
5828 | 5828 |
|
5829 | 5829 |
-- |
5830 |
-- Name: place_matched_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5830 |
-- Name: place_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5831 | 5831 |
-- |
5832 | 5832 |
|
5833 | 5833 |
ALTER TABLE ONLY place |
5834 |
ADD CONSTRAINT place_matched_place_id_fkey FOREIGN KEY (matched_place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5834 |
ADD CONSTRAINT place_place_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5835 | 5835 |
|
5836 | 5836 |
|
5837 | 5837 |
-- |
5838 |
-- Name: place_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5838 |
-- Name: place_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5839 | 5839 |
-- |
5840 | 5840 |
|
5841 | 5841 |
ALTER TABLE ONLY place |
5842 |
ADD CONSTRAINT place_place_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5842 |
ADD CONSTRAINT place_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5843 | 5843 |
|
5844 | 5844 |
|
5845 | 5845 |
-- |
... | ... | |
5891 | 5891 |
|
5892 | 5892 |
|
5893 | 5893 |
-- |
5894 |
-- Name: plantobservation_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5894 |
-- Name: plantobservation_plant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5895 | 5895 |
-- |
5896 | 5896 |
|
5897 | 5897 |
ALTER TABLE ONLY plantobservation |
5898 |
ADD CONSTRAINT plantobservation_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5898 |
ADD CONSTRAINT plantobservation_plant_id_fkey FOREIGN KEY (plant_id) REFERENCES plant(plant_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5899 | 5899 |
|
5900 | 5900 |
|
5901 | 5901 |
-- |
5902 |
-- Name: plantobservation_plant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5902 |
-- Name: plantobservation_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5903 | 5903 |
-- |
5904 | 5904 |
|
5905 | 5905 |
ALTER TABLE ONLY plantobservation |
5906 |
ADD CONSTRAINT plantobservation_plant_id_fkey FOREIGN KEY (plant_id) REFERENCES plant(plant_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5906 |
ADD CONSTRAINT plantobservation_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5907 | 5907 |
|
5908 | 5908 |
|
5909 | 5909 |
-- |
5910 |
-- Name: project_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5910 |
-- Name: project_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5911 | 5911 |
-- |
5912 | 5912 |
|
5913 | 5913 |
ALTER TABLE ONLY project |
5914 |
ADD CONSTRAINT project_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5914 |
ADD CONSTRAINT project_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5915 | 5915 |
|
5916 | 5916 |
|
5917 | 5917 |
-- |
... | ... | |
5995 | 5995 |
|
5996 | 5996 |
|
5997 | 5997 |
-- |
5998 |
-- Name: specimenreplicate_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5998 |
-- Name: specimenreplicate_institution_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5999 | 5999 |
-- |
6000 | 6000 |
|
6001 | 6001 |
ALTER TABLE ONLY specimenreplicate |
6002 |
ADD CONSTRAINT specimenreplicate_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6002 |
ADD CONSTRAINT specimenreplicate_institution_id_fkey FOREIGN KEY (institution_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6003 | 6003 |
|
6004 | 6004 |
|
6005 | 6005 |
-- |
6006 |
-- Name: specimenreplicate_institution_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6006 |
-- Name: specimenreplicate_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6007 | 6007 |
-- |
6008 | 6008 |
|
6009 | 6009 |
ALTER TABLE ONLY specimenreplicate |
6010 |
ADD CONSTRAINT specimenreplicate_institution_id_fkey FOREIGN KEY (institution_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6010 |
ADD CONSTRAINT specimenreplicate_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6011 | 6011 |
|
6012 | 6012 |
|
6013 | 6013 |
-- |
6014 |
-- Name: specimenreplicate_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6014 |
-- Name: specimenreplicate_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6015 | 6015 |
-- |
6016 | 6016 |
|
6017 | 6017 |
ALTER TABLE ONLY specimenreplicate |
6018 |
ADD CONSTRAINT specimenreplicate_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6018 |
ADD CONSTRAINT specimenreplicate_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6019 | 6019 |
|
6020 | 6020 |
|
6021 | 6021 |
-- |
... | ... | |
6027 | 6027 |
|
6028 | 6028 |
|
6029 | 6029 |
-- |
6030 |
-- Name: stemobservation_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6030 |
-- Name: stemobservation_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6031 | 6031 |
-- |
6032 | 6032 |
|
6033 | 6033 |
ALTER TABLE ONLY stemobservation |
6034 |
ADD CONSTRAINT stemobservation_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6034 |
ADD CONSTRAINT stemobservation_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6035 | 6035 |
|
6036 | 6036 |
|
6037 | 6037 |
-- |
6038 |
-- Name: stemobservation_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6038 |
-- Name: stemobservation_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6039 | 6039 |
-- |
6040 | 6040 |
|
6041 | 6041 |
ALTER TABLE ONLY stemobservation |
6042 |
ADD CONSTRAINT stemobservation_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6042 |
ADD CONSTRAINT stemobservation_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6043 | 6043 |
|
6044 | 6044 |
|
6045 | 6045 |
-- |
... | ... | |
6147 | 6147 |
|
6148 | 6148 |
|
6149 | 6149 |
-- |
6150 |
-- Name: taxonlabel_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6150 |
-- Name: taxonlabel_matched_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6151 | 6151 |
-- |
6152 | 6152 |
|
6153 | 6153 |
ALTER TABLE ONLY taxonlabel |
6154 |
ADD CONSTRAINT taxonlabel_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6154 |
ADD CONSTRAINT taxonlabel_matched_label_id_fkey FOREIGN KEY (matched_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6155 | 6155 |
|
6156 | 6156 |
|
6157 | 6157 |
-- |
6158 |
-- Name: taxonlabel_matched_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6158 |
-- Name: taxonlabel_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6159 | 6159 |
-- |
6160 | 6160 |
|
6161 | 6161 |
ALTER TABLE ONLY taxonlabel |
6162 |
ADD CONSTRAINT taxonlabel_matched_label_id_fkey FOREIGN KEY (matched_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6162 |
ADD CONSTRAINT taxonlabel_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6163 | 6163 |
|
6164 | 6164 |
|
6165 | 6165 |
-- |
6166 |
-- Name: taxonlabel_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6166 |
-- Name: taxonlabel_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6167 | 6167 |
-- |
6168 | 6168 |
|
6169 | 6169 |
ALTER TABLE ONLY taxonlabel |
6170 |
ADD CONSTRAINT taxonlabel_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6170 |
ADD CONSTRAINT taxonlabel_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6171 | 6171 |
|
6172 | 6172 |
|
6173 | 6173 |
-- |
... | ... | |
6203 | 6203 |
|
6204 | 6204 |
|
6205 | 6205 |
-- |
6206 |
-- Name: taxonoccurrence_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6206 |
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6207 | 6207 |
-- |
6208 | 6208 |
|
6209 | 6209 |
ALTER TABLE ONLY taxonoccurrence |
6210 |
ADD CONSTRAINT taxonoccurrence_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6210 |
ADD CONSTRAINT taxonoccurrence_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6211 | 6211 |
|
6212 | 6212 |
|
6213 | 6213 |
-- |
6214 |
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6214 |
-- Name: taxonoccurrence_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6215 | 6215 |
-- |
6216 | 6216 |
|
6217 | 6217 |
ALTER TABLE ONLY taxonoccurrence |
6218 |
ADD CONSTRAINT taxonoccurrence_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6218 |
ADD CONSTRAINT taxonoccurrence_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
6219 | 6219 |
|
6220 | 6220 |
|
6221 | 6221 |
-- |
Also available in: Unified diff
mappings/VegCore-VegBIEN.csv: Renamed creator_ids to reference_id since they are now fkeys to reference