Project

General

Profile

« Previous | Next » 

Revision 5855

schemas/vegbien.sql: Renamed placepath to place since this contains primary information about the place, including the reference to the canonical place

View differences:

vegbien.sql
469 469

  
470 470

  
471 471
--
472
-- Name: place_matched_place_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
473
--
474

  
475
CREATE FUNCTION place_matched_place_id_self_ref() RETURNS trigger
476
    LANGUAGE plpgsql
477
    AS $$
478
BEGIN
479
    IF new.place_id IS NULL THEN -- prepopulate place_id
480
        new.place_id = nextval('place_place_id_seq'::regclass);
481
    END IF;
482
    IF new.matched_place_id = 0 THEN -- make self-reference
483
        new.matched_place_id = new.place_id;
484
    END IF;
485
    RETURN new;
486
END;
487
$$;
488

  
489

  
490
--
472 491
-- Name: placename_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
473 492
--
474 493

  
......
521 540

  
522 541

  
523 542
--
524
-- Name: placepath_matched_placepath_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
525
--
526

  
527
CREATE FUNCTION placepath_matched_placepath_id_self_ref() RETURNS trigger
528
    LANGUAGE plpgsql
529
    AS $$
530
BEGIN
531
    IF new.placepath_id IS NULL THEN -- prepopulate placepath_id
532
        new.placepath_id = nextval('placepath_placepath_id_seq'::regclass);
533
    END IF;
534
    IF new.matched_placepath_id = 0 THEN -- make self-reference
535
        new.matched_placepath_id = new.placepath_id;
536
    END IF;
537
    RETURN new;
538
END;
539
$$;
540

  
541

  
542
--
543 543
-- Name: plantobservation_aggregateoccurrence_count_1(); Type: FUNCTION; Schema: public; Owner: -
544 544
--
545 545

  
......
1301 1301
CREATE TABLE locationplace (
1302 1302
    locationplace_id integer NOT NULL,
1303 1303
    location_id integer NOT NULL,
1304
    placepath_id integer NOT NULL,
1304
    place_id integer NOT NULL,
1305 1305
    identifier_id integer
1306 1306
);
1307 1307

  
......
1534 1534

  
1535 1535

  
1536 1536
--
1537
-- Name: placepath; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1537
-- Name: place; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1538 1538
--
1539 1539

  
1540
CREATE TABLE placepath (
1541
    placepath_id integer NOT NULL,
1540
CREATE TABLE place (
1541
    place_id integer NOT NULL,
1542 1542
    creator_id integer NOT NULL,
1543 1543
    placecode text,
1544
    matched_placepath_id integer,
1544
    matched_place_id integer,
1545 1545
    placename_id integer,
1546 1546
    continent text,
1547 1547
    country text,
......
1550 1550
    municipality text,
1551 1551
    site text,
1552 1552
    otherranks rankedplacename[],
1553
    CONSTRAINT placepath_required_key CHECK (((((((placecode IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)) OR (otherranks IS NOT NULL)))
1553
    CONSTRAINT place_required_key CHECK (((((((placecode IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)) OR (otherranks IS NOT NULL)))
1554 1554
);
1555 1555

  
1556 1556

  
1557 1557
--
1558
-- Name: TABLE placepath; Type: COMMENT; Schema: public; Owner: -
1558
-- Name: TABLE place; Type: COMMENT; Schema: public; Owner: -
1559 1559
--
1560 1560

  
1561
COMMENT ON TABLE placepath IS 'The full path to a place. Can be either verbatim or accepted. For accepted names, points to the identified place.
1561
COMMENT ON TABLE place IS 'The full path to a place. Can be either verbatim or accepted. For accepted names, points to the identified place.
1562 1562

  
1563 1563
To include a placename at a rank with no explicit column, add it to the otherranks array.';
1564 1564

  
1565 1565

  
1566 1566
--
1567
-- Name: COLUMN placepath.matched_placepath_id; Type: COMMENT; Schema: public; Owner: -
1567
-- Name: COLUMN place.matched_place_id; Type: COMMENT; Schema: public; Owner: -
1568 1568
--
1569 1569

  
1570
COMMENT ON COLUMN placepath.matched_placepath_id IS 'The placepath containing the accepted name of this verbatim place path.  placepaths should be linked in a two-level hierarchy of datasource name -> accepted name.
1570
COMMENT ON COLUMN place.matched_place_id IS 'The canonical place for this verbatim place. Places should be linked in a two-level hierarchy of verbatim place -> accepted place.
1571 1571

  
1572
A accepted name should point to itself in this field. This will happen automatically by setting it to the special value 0.';
1572
An accepted place should point to itself in this field. This will happen automatically by setting it to the special value 0.';
1573 1573

  
1574 1574

  
1575 1575
--
1576
-- Name: COLUMN placepath.otherranks; Type: COMMENT; Schema: public; Owner: -
1576
-- Name: COLUMN place.otherranks; Type: COMMENT; Schema: public; Owner: -
1577 1577
--
1578 1578

  
1579
COMMENT ON COLUMN placepath.otherranks IS 'Additional ranks which do not have a named column. Put ranks in path order, so that lower-level places come after higher-level places.';
1579
COMMENT ON COLUMN place.otherranks IS 'Additional ranks which do not have a named column. Put ranks in path order, so that lower-level places come after higher-level places.';
1580 1580

  
1581 1581

  
1582 1582
--
......
1864 1864
--
1865 1865

  
1866 1866
CREATE VIEW analytical_db_view AS
1867
    SELECT datasource.organizationname AS "institutionCode", placepath.country, placepath.stateprovince AS "stateProvince", placepath.county, locationcoords.latitude_deg AS "decimalLatitude", locationcoords.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.binomial) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonverbatim.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 locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_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));
1867
    SELECT datasource.organizationname AS "institutionCode", place.country, place.stateprovince AS "stateProvince", place.county, locationcoords.latitude_deg AS "decimalLatitude", locationcoords.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.binomial) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonverbatim.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 locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place USING (place_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));
1868 1868

  
1869 1869

  
1870 1870
--
......
2691 2691

  
2692 2692

  
2693 2693
--
2694
-- Name: place_place_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2695
--
2696

  
2697
CREATE SEQUENCE place_place_id_seq
2698
    START WITH 1
2699
    INCREMENT BY 1
2700
    NO MINVALUE
2701
    NO MAXVALUE
2702
    CACHE 1;
2703

  
2704

  
2705
--
2706
-- Name: place_place_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2707
--
2708

  
2709
ALTER SEQUENCE place_place_id_seq OWNED BY place.place_id;
2710

  
2711

  
2712
--
2694 2713
-- Name: placecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2695 2714
--
2696 2715

  
......
2782 2801

  
2783 2802

  
2784 2803
--
2785
-- Name: placepath_placepath_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2786
--
2787

  
2788
CREATE SEQUENCE placepath_placepath_id_seq
2789
    START WITH 1
2790
    INCREMENT BY 1
2791
    NO MINVALUE
2792
    NO MAXVALUE
2793
    CACHE 1;
2794

  
2795

  
2796
--
2797
-- Name: placepath_placepath_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2798
--
2799

  
2800
ALTER SEQUENCE placepath_placepath_id_seq OWNED BY placepath.placepath_id;
2801

  
2802

  
2803
--
2804 2804
-- Name: plant; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2805 2805
--
2806 2806

  
......
3948 3948

  
3949 3949

  
3950 3950
--
3951
-- Name: placecorrelation_id; Type: DEFAULT; Schema: public; Owner: -
3951
-- Name: place_id; Type: DEFAULT; Schema: public; Owner: -
3952 3952
--
3953 3953

  
3954
ALTER TABLE placecorrelation ALTER COLUMN placecorrelation_id SET DEFAULT nextval('placecorrelation_placecorrelation_id_seq'::regclass);
3954
ALTER TABLE place ALTER COLUMN place_id SET DEFAULT nextval('place_place_id_seq'::regclass);
3955 3955

  
3956 3956

  
3957 3957
--
3958
-- Name: placename_id; Type: DEFAULT; Schema: public; Owner: -
3958
-- Name: placecorrelation_id; Type: DEFAULT; Schema: public; Owner: -
3959 3959
--
3960 3960

  
3961
ALTER TABLE placename ALTER COLUMN placename_id SET DEFAULT nextval('placename_placename_id_seq'::regclass);
3961
ALTER TABLE placecorrelation ALTER COLUMN placecorrelation_id SET DEFAULT nextval('placecorrelation_placecorrelation_id_seq'::regclass);
3962 3962

  
3963 3963

  
3964 3964
--
3965
-- Name: placepath_id; Type: DEFAULT; Schema: public; Owner: -
3965
-- Name: placename_id; Type: DEFAULT; Schema: public; Owner: -
3966 3966
--
3967 3967

  
3968
ALTER TABLE placepath ALTER COLUMN placepath_id SET DEFAULT nextval('placepath_placepath_id_seq'::regclass);
3968
ALTER TABLE placename ALTER COLUMN placename_id SET DEFAULT nextval('placename_placename_id_seq'::regclass);
3969 3969

  
3970 3970

  
3971 3971
--
......
4437 4437

  
4438 4438

  
4439 4439
--
4440
-- Name: place_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4441
--
4442

  
4443
ALTER TABLE ONLY place
4444
    ADD CONSTRAINT place_pkey PRIMARY KEY (place_id);
4445

  
4446

  
4447
--
4440 4448
-- Name: placecorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4441 4449
--
4442 4450

  
......
4461 4469

  
4462 4470

  
4463 4471
--
4464
-- Name: placepath_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4465
--
4466

  
4467
ALTER TABLE ONLY placepath
4468
    ADD CONSTRAINT placepath_pkey PRIMARY KEY (placepath_id);
4469

  
4470

  
4471
--
4472 4472
-- Name: plant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4473 4473
--
4474 4474

  
......
4928 4928
-- Name: locationplace_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4929 4929
--
4930 4930

  
4931
CREATE UNIQUE INDEX locationplace_unique ON locationplace USING btree (location_id, placepath_id, (COALESCE(identifier_id, 2147483647)));
4931
CREATE UNIQUE INDEX locationplace_unique ON locationplace USING btree (location_id, place_id, (COALESCE(identifier_id, 2147483647)));
4932 4932

  
4933 4933

  
4934 4934
--
......
4974 4974

  
4975 4975

  
4976 4976
--
4977
-- Name: placename_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4977
-- Name: place_unique_within_creator_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4978 4978
--
4979 4979

  
4980
CREATE UNIQUE INDEX placename_accessioncode_index ON placename USING btree (accessioncode);
4980
CREATE UNIQUE INDEX place_unique_within_creator_by_code ON place USING btree (creator_id, (COALESCE(placecode, '\\N'::text))) WHERE (placecode IS NOT NULL);
4981 4981

  
4982 4982

  
4983 4983
--
4984
-- Name: placename_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4984
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4985 4985
--
4986 4986

  
4987
CREATE UNIQUE INDEX placename_unique ON placename USING btree ((COALESCE(parent_id, 2147483647)), placename, rank);
4987
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(municipality, '\\N'::text)), (COALESCE(site, '\\N'::text)), (COALESCE(otherranks, ARRAY[]::rankedplacename[]))) WHERE (placecode IS NULL);
4988 4988

  
4989 4989

  
4990 4990
--
4991
-- Name: placepath_unique_within_creator_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4991
-- Name: placename_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4992 4992
--
4993 4993

  
4994
CREATE UNIQUE INDEX placepath_unique_within_creator_by_code ON placepath USING btree (creator_id, (COALESCE(placecode, '\\N'::text))) WHERE (placecode IS NOT NULL);
4994
CREATE UNIQUE INDEX placename_accessioncode_index ON placename USING btree (accessioncode);
4995 4995

  
4996 4996

  
4997 4997
--
4998
-- Name: placepath_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4998
-- Name: placename_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4999 4999
--
5000 5000

  
5001
CREATE UNIQUE INDEX placepath_unique_within_creator_by_name ON placepath USING btree (creator_id, (COALESCE(continent, '\\N'::text)), (COALESCE(country, '\\N'::text)), (COALESCE(stateprovince, '\\N'::text)), (COALESCE(county, '\\N'::text)), (COALESCE(municipality, '\\N'::text)), (COALESCE(site, '\\N'::text)), (COALESCE(otherranks, ARRAY[]::rankedplacename[]))) WHERE (placecode IS NULL);
5001
CREATE UNIQUE INDEX placename_unique ON placename USING btree ((COALESCE(parent_id, 2147483647)), placename, rank);
5002 5002

  
5003 5003

  
5004 5004
--
......
5226 5226

  
5227 5227

  
5228 5228
--
5229
-- Name: placename_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
5229
-- Name: place_matched_place_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
5230 5230
--
5231 5231

  
5232
CREATE CONSTRAINT TRIGGER placename_update_ancestors AFTER INSERT OR UPDATE ON placename DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE placename_update_ancestors();
5232
CREATE TRIGGER place_matched_place_id_self_ref BEFORE INSERT OR UPDATE ON place FOR EACH ROW EXECUTE PROCEDURE place_matched_place_id_self_ref();
5233 5233

  
5234 5234

  
5235 5235
--
5236
-- Name: placepath_matched_placepath_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
5236
-- Name: placename_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
5237 5237
--
5238 5238

  
5239
CREATE TRIGGER placepath_matched_placepath_id_self_ref BEFORE INSERT OR UPDATE ON placepath FOR EACH ROW EXECUTE PROCEDURE placepath_matched_placepath_id_self_ref();
5239
CREATE CONSTRAINT TRIGGER placename_update_ancestors AFTER INSERT OR UPDATE ON placename DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE placename_update_ancestors();
5240 5240

  
5241 5241

  
5242 5242
--
......
5712 5712

  
5713 5713

  
5714 5714
--
5715
-- Name: locationplace_placepath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5715
-- Name: locationplace_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5716 5716
--
5717 5717

  
5718 5718
ALTER TABLE ONLY locationplace
5719
    ADD CONSTRAINT locationplace_placepath_id_fkey FOREIGN KEY (placepath_id) REFERENCES placepath(placepath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5719
    ADD CONSTRAINT locationplace_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
5720 5720

  
5721 5721

  
5722 5722
--
......
5816 5816

  
5817 5817

  
5818 5818
--
5819
-- Name: place_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5820
--
5821

  
5822
ALTER TABLE ONLY place
5823
    ADD CONSTRAINT place_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5824

  
5825

  
5826
--
5827
-- Name: place_matched_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5828
--
5829

  
5830
ALTER TABLE ONLY place
5831
    ADD CONSTRAINT place_matched_place_id_fkey FOREIGN KEY (matched_place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
5832

  
5833

  
5834
--
5835
-- Name: place_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5836
--
5837

  
5838
ALTER TABLE ONLY place
5839
    ADD CONSTRAINT place_place_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;
5840

  
5841

  
5842
--
5819 5843
-- Name: placecorrelation_childplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5820 5844
--
5821 5845

  
......
5856 5880

  
5857 5881

  
5858 5882
--
5859
-- Name: placepath_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5860
--
5861

  
5862
ALTER TABLE ONLY placepath
5863
    ADD CONSTRAINT placepath_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5864

  
5865

  
5866
--
5867
-- Name: placepath_matched_placepath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5868
--
5869

  
5870
ALTER TABLE ONLY placepath
5871
    ADD CONSTRAINT placepath_matched_placepath_id_fkey FOREIGN KEY (matched_placepath_id) REFERENCES placepath(placepath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5872

  
5873

  
5874
--
5875
-- Name: placepath_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5876
--
5877

  
5878
ALTER TABLE ONLY placepath
5879
    ADD CONSTRAINT placepath_place_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;
5880

  
5881

  
5882
--
5883 5883
-- Name: plantobservation_aggregateoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5884 5884
--
5885 5885

  

Also available in: Unified diff