--
-- PostgreSQL database dump
--








--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--





--
-- Name: occurrencestatus_dwc; Type: TYPE; Schema: public; Owner: -
--




--
-- Name: aggregateoccurrence_plantobs_count_1(); Type: FUNCTION; Schema: public; Owner: -
--




--
-- Name: concat(text); Type: AGGREGATE; Schema: public; Owner: -
--








--
-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address (
    address_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    organization_id int(11),
    orgposition character varying(50),
    email character varying(100),
    deliverypoint character varying(200),
    city character varying(50),
    administrativearea character varying(50),
    postalcode character varying(10),
    country character varying(50),
    currentflag int(1),
    addressstartdate timestamp NULL
);


--
-- Name: address_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: address_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: aggregateoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE aggregateoccurrence (
    aggregateoccurrence_id int(11) NOT NULL,
    taxonoccurrence_id int(11) NOT NULL,
    cover double precision,
    basalarea double precision,
    biomass double precision,
    inferencearea double precision,
    stratumbase double precision,
    stratumheight double precision,
    emb_aggregateoccurrence int(11),
    covercode character varying(10),
    count int(11),
    accessioncode character varying(255),
    sourceaccessioncode character varying(100),
    plantobservation_id int(11),
    stratum_id int(11),
    sizeclass_id int(11),
    coverindex_id int(11),
    occurrencestatus_dwc text DEFAULT 'present'
);


--
-- Name: TABLE aggregateoccurrence; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: COLUMN aggregateoccurrence.occurrencestatus_dwc; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: classcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE classcontributor (
    classcontributor_id int(11) NOT NULL,
    commclass_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    role_id int(11),
    emb_classcontributor int(11)
);


--
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commclass (
    commclass_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    inspection int(1),
    tableanalysis int(1),
    multivariateanalysis int(1),
    classpublication_id int(11),
    classnotes text,
    commname character varying(200),
    commcode character varying(200),
    commframework character varying(200),
    commlevel character varying(200),
    classstartdate timestamp NULL,
    classstopdate timestamp NULL,
    emb_commclass int(11),
    expertsystem text,
    accessioncode character varying(255)
);


--
-- Name: commclass_commclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commclass_commclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commconcept (
    commconcept_id int(11) NOT NULL,
    commname_id int(11) NOT NULL,
    reference_id int(11),
    commdescription text,
    d_obscount int(11),
    commname text,
    d_currentaccepted int(1),
    accessioncode character varying(255)
);


--
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commcorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commcorrelation (
    commcorrelation_id int(11) NOT NULL,
    commstatus_id int(11) NOT NULL,
    commconcept_id int(11) NOT NULL,
    commconvergence character varying(20) NOT NULL,
    correlationstart timestamp NOT NULL,
    correlationstop timestamp NULL
);


--
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commdetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commdetermination (
    commdetermination_id int(11) NOT NULL,
    commclass_id int(11) NOT NULL,
    commconcept_id int(11),
    commcode character varying(34),
    commname character varying(200),
    classfit character varying(50),
    classconfidence character varying(15),
    commauthority_id int(11),
    notes text,
    type int(1),
    nomenclaturaltype int(1),
    emb_commdetermination int(11)
);


--
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commlineage (
    commlineage_id int(11) NOT NULL,
    parentcommstatus_id int(11) NOT NULL,
    childcommstatus_id int(11) NOT NULL
);


--
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commname (
    commname_id int(11) NOT NULL,
    commname text NOT NULL,
    reference_id int(11),
    dateentered timestamp NULL 
);


--
-- Name: commname_commname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commname_commname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commstatus (
    commstatus_id int(11) NOT NULL,
    commconcept_id int(11) NOT NULL,
    reference_id int(11),
    commconceptstatus character varying(20) NOT NULL,
    commparent_id int(11),
    commlevel character varying(80),
    commpartycomments text,
    party_id int(11) NOT NULL,
    startdate timestamp NOT NULL,
    stopdate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: commusage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commusage (
    commusage_id int(11) NOT NULL,
    commname_id int(11) NOT NULL,
    commname text,
    commconcept_id int(11),
    commnamestatus character varying(20),
    classsystem character varying(50),
    party_id int(11),
    commstatus_id int(11),
    usagestart timestamp NULL,
    usagestop timestamp NULL
);


--
-- Name: commusage_commusage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: commusage_commusage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: coverindex; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE coverindex (
    coverindex_id int(11) NOT NULL,
    covermethod_id int(11) NOT NULL,
    covercode character varying(10) NOT NULL,
    upperlimit double precision,
    lowerlimit double precision,
    coverpercent double precision NOT NULL,
    indexdescription text
);


--
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: covermethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE covermethod (
    covermethod_id int(11) NOT NULL,
    reference_id int(11),
    covertype character varying(30) NOT NULL,
    coverestimationmethod character varying(80),
    accessioncode character varying(255)
);


--
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_confidentialitystatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_confidentialitystatus (
    confidentialitystatus int(11) NOT NULL,
    confidentialitytext character varying(100),
    confidentialityshorttext character varying(100)
);


--
-- Name: dba_cookie; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_cookie (
    cookie_id int(11) NOT NULL,
    cookiename character varying(75) NOT NULL,
    defaultvalue character varying(75) NOT NULL,
    viewname character varying(25) NOT NULL,
    description text,
    examplepk int(11) NOT NULL,
    sortorder int(11),
    startgroup int(1),
    prefixhtml text,
    suffixhtml text
);


--
-- Name: dba_cookie_cookie_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_cookie_cookie_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_cookielabels; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_cookielabels (
    cookielabel_id int(11) NOT NULL,
    vieworcookie character varying(50) NOT NULL,
    description text
);


--
-- Name: dba_cookielabels_cookielabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_cookielabels_cookielabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: dba_datacache; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_datacache (
    dba_datacache_id int(11) NOT NULL,
    cache_key character varying(200) NOT NULL,
    cache_label character varying(200),
    cache_order double precision,
    data1 character varying(255),
    data2 character varying(255),
    data3 character varying(255),
    data4 character varying(255),
    data5 character varying(255),
    data6 character varying(255),
    data7 character varying(255),
    data8 character varying(255),
    data9 character varying(255),
    data10 character varying(255)
);


--
-- Name: dba_datacache_dba_datacache_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_datacache_dba_datacache_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_datamodelversion; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_datamodelversion (
    dba_datamodelversion_id int(11) NOT NULL,
    versiontext character varying(20) NOT NULL,
    versionimplemented timestamp NULL 
);


--
-- Name: dba_datamodelversion_dba_datamodelversion_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_datamodelversion_dba_datamodelversion_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: dba_dbstatstime; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_dbstatstime (
    stat_id int(11) NOT NULL,
    statdate timestamp NULL,
    statpkg int(11),
    statname text,
    stattable character varying(100),
    minpk int(11),
    maxpk int(11),
    countrecs int(11)
);


--
-- Name: dba_dbstatstime_stat_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_dbstatstime_stat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: dba_fielddescription; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_fielddescription (
    dba_fielddescription_id int(11) NOT NULL,
    tablename character varying(75),
    fieldname character varying(75),
    fieldlabel character varying(200),
    fieldmodel character varying(50),
    fieldnulls character varying(10),
    fieldtype character varying(30),
    fieldkey character varying(10),
    fieldreferences character varying(200),
    fieldlist character varying(50),
    fieldnotes text,
    fielddefinition text,
    fieldkeywords text
);


--
-- Name: dba_fielddescription_dba_fielddescription_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_fielddescription_dba_fielddescription_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_fieldlist; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_fieldlist (
    dba_fieldlist_id int(11) NOT NULL,
    tablename character varying(75),
    fieldname character varying(75),
    listvalue character varying(255),
    listvaluedescription text,
    listvaluesortorder double precision
);


--
-- Name: dba_fieldlist_dba_fieldlist_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_fieldlist_dba_fieldlist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_onerow; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_onerow (
    dba_onerow_id int(11) NOT NULL
);


--
-- Name: dba_onerow_dba_onerow_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_onerow_dba_onerow_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_preassignacccode; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_preassignacccode (
    dba_preassignacccode_id int(11) NOT NULL,
    dba_requestnumber int(11) NOT NULL,
    databasekey character varying(20) NOT NULL,
    tableabbrev character varying(10) NOT NULL,
    confirmcode character varying(70)  NOT NULL,
    codeisused int(1),
    accessioncode character varying(255)
);


--
-- Name: dba_preassignacccode_dba_preassignacccode_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_preassignacccode_dba_preassignacccode_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_tabledescription; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_tabledescription (
    dba_tabledescription_id int(11) NOT NULL,
    tablename character varying(75),
    tablelabel character varying(200),
    tablenotes text,
    tabledescription text,
    tablekeywords text
);


--
-- Name: dba_tabledescription_dba_tabledescription_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: dba_tabledescription_dba_tabledescription_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: dba_xmlcache; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE dba_xmlcache (
    xml blob,
    accessioncode character varying(255)
);




--
-- Name: definedvalue; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE definedvalue (
    definedvalue_id int(11) NOT NULL,
    userdefined_id int(11) NOT NULL,
    tablerecord_id int(11) NOT NULL,
    definedvalue text NOT NULL
);


--
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: disturbanceobs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE disturbanceobs (
    disturbanceobs_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    disturbancetype character varying(30) NOT NULL,
    disturbanceintensity character varying(30),
    disturbanceage double precision,
    disturbanceextent double precision,
    disturbancecomment text,
    emb_disturbanceobs int(11)
);


--
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: embargo; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE embargo (
    embargo_id int(11) NOT NULL,
    location_id int(11) NOT NULL,
    embargoreason text NOT NULL,
    defaultstatus int(11) NOT NULL,
    embargostart timestamp NOT NULL,
    embargostop timestamp NOT NULL
);


--
-- Name: embargo_embargo_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: embargo_embargo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: graphic; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE graphic (
    graphic_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    graphicname character varying(30),
    graphiclocation text,
    graphicdescription text,
    graphictype character varying(20),
    graphicdata int(11),
    graphicdate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: graphic_graphic_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: graphic_graphic_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: keywords; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE keywords (
    table_id int(11) NOT NULL,
    entity text NOT NULL,
    keywords text
);


--
-- Name: keywords_extra; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE keywords_extra (
    table_id int(11) NOT NULL,
    entity text NOT NULL,
    keywords text
);


--
-- Name: location; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE location (
    location_id int(11) NOT NULL,
    authorlocationcode character varying(30),
    reference_id int(11),
    parent_id int(11),
    reallatitude double precision,
    reallongitude double precision,
    locationaccuracy double precision,
    confidentialitystatus int(11) DEFAULT 0 NOT NULL,
    confidentialityreason character varying(200),
    publiclatitude double precision,
    publiclongitude double precision,
    accessioncode character varying(255),
    sublocationxposition double precision,
    sublocationyposition double precision,
    authore character varying(20),
    authorn character varying(20),
    authorzone character varying(20),
    authordatum character varying(20),
    authorlocation character varying(200),
    locationnarrative text,
    azimuth double precision,
    dsgpoly text,
    shape character varying(50),
    area double precision,
    standsize character varying(50),
    placementmethod character varying(50),
    permanence int(1),
    layoutnarrative text,
    elevation double precision,
    elevationaccuracy double precision,
    elevationrange double precision,
    slopeaspect double precision,
    minslopeaspect double precision,
    maxslopeaspect double precision,
    slopegradient double precision,
    minslopegradient double precision,
    maxslopegradient double precision,
    topoposition character varying(90),
    landform character varying(50),
    surficialdeposits character varying(90),
    rocktype character varying(90),
    stateprovince character varying(55),
    country character varying(100),
    submitter_surname character varying(100),
    submitter_givenname character varying(100),
    submitter_email character varying(100),
    notespublic int(1),
    notesmgt int(1),
    revisions int(1),
    dateentered timestamp NULL ,
    emb_location int(11),
    locationrationalenarrative text
);


--
-- Name: location_location_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: location_location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: locationevent; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationevent (
    locationevent_id int(11) NOT NULL,
    previous_id int(11),
    location_id int(11),
    project_id int(11),
    authoreventcode character varying(30),
    accessioncode character varying(255),
    sourceaccessioncode character varying(100),
    dateaccuracy character varying(30),
    covermethod_id int(11),
    coverdispersion character varying(30),
    autotaxoncover int(1),
    methodnarrative text,
    taxonoccurrencearea double precision,
    stemsizelimit double precision,
    stemarea double precision,
    stemsamplemethod character varying(30),
    originaldata text,
    effortlevel character varying(30),
    locationvalidationlevel int(11),
    floristicquality character varying(30),
    bryophytequality character varying(30),
    lichenquality character varying(30),
    locationeventnarrative text,
    landscapenarrative text,
    homogeneity character varying(50),
    phenologicaspect character varying(30),
    representativeness character varying(255),
    standmaturity character varying(50),
    successionalstatus text,
    basalarea double precision,
    hydrologicregime character varying(30),
    soilmoistureregime character varying(30),
    soildrainage character varying(30),
    watersalinity character varying(30),
    waterdepth double precision,
    shoredistance double precision,
    soildepth double precision,
    organicdepth double precision,
    soiltaxon_id int(11),
    soiltaxonsrc character varying(200),
    percentbedrock double precision,
    percentrockgravel double precision,
    percentwood double precision,
    percentlitter double precision,
    percentbaresoil double precision,
    percentwater double precision,
    percentother double precision,
    nameother character varying(30),
    treeht double precision,
    shrubht double precision,
    fieldht double precision,
    nonvascularht double precision,
    submergedht double precision,
    treecover double precision,
    shrubcover double precision,
    fieldcover double precision,
    nonvascularcover double precision,
    floatingcover double precision,
    submergedcover double precision,
    dominantstratum character varying(40),
    growthform1type character varying(40),
    growthform2type character varying(40),
    growthform3type character varying(40),
    growthform1cover double precision,
    growthform2cover double precision,
    growthform3cover double precision,
    totalcover double precision,
    notespublic int(1),
    notesmgt int(1),
    revisions int(1),
    obsstartdate timestamp NULL,
    obsenddate timestamp NULL,
    dateentered timestamp NULL ,
    emb_locationevent int(11),
    interp_orig_ci_id int(11),
    interp_orig_cc_id int(11),
    interp_orig_sciname text,
    interp_orig_code text,
    interp_orig_party_id int(11),
    interp_orig_partyname text,
    interp_current_ci_id int(11),
    interp_current_cc_id int(11),
    interp_current_sciname text,
    interp_current_code text,
    interp_current_party_id int(11),
    interp_current_partyname text,
    interp_bestfit_ci_id int(11),
    interp_bestfit_cc_id int(11),
    interp_bestfit_sciname text,
    interp_bestfit_code text,
    interp_bestfit_party_id int(11),
    interp_bestfit_partyname text,
    toptaxon1name character varying(255),
    toptaxon2name character varying(255),
    toptaxon3name character varying(255),
    toptaxon4name character varying(255),
    toptaxon5name character varying(255),
    numberoftaxa int(11)
);


--
-- Name: TABLE locationevent; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: locationeventcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationeventcontributor (
    locationeventcontributor_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    role_id int(11) NOT NULL,
    contributiondate timestamp NULL
);


--
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: locationeventsynonym; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationeventsynonym (
    locationeventsynonym_id int(11) NOT NULL,
    synonymlocationevent_id int(11) NOT NULL,
    primarylocationevent_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    role_id int(11) NOT NULL,
    synonymcomment text,
    classstartdate timestamp NULL  NOT NULL,
    classstopdate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: locationplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationplace (
    locationplace_id int(11) NOT NULL,
    location_id int(11) NOT NULL,
    calculated int(1),
    namedplace_id int(11) NOT NULL
);


--
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: namedplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE namedplace (
    namedplace_id int(11) NOT NULL,
    placesystem character varying(50),
    placename character varying(100) NOT NULL,
    placedescription text,
    placecode character varying(15),
    owner character varying(100),
    reference_id int(11),
    d_obscount int(11),
    accessioncode character varying(255)
);


--
-- Name: namedplace_namedplace_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: namedplace_namedplace_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: namedplacecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE namedplacecorrelation (
    namedplacecorrelation_id int(11) NOT NULL,
    parentplace_id int(11) NOT NULL,
    childplace_id int(11) NOT NULL,
    placeconvergence character varying(20) NOT NULL
);


--
-- Name: namedplacecorrelation_namedplacecorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: namedplacecorrelation_namedplacecorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: note; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE note (
    note_id int(11) NOT NULL,
    notelink_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    role_id int(11) NOT NULL,
    notetype character varying(20) NOT NULL,
    notetext text NOT NULL,
    notedate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: note_note_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: note_note_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: notelink; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE notelink (
    notelink_id int(11) NOT NULL,
    tablename character varying(50) NOT NULL,
    attributename character varying(50),
    tablerecord int(11) NOT NULL
);


--
-- Name: notelink_notelink_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: notelink_notelink_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: party; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE party (
    party_id int(11) NOT NULL,
    salutation character varying(20),
    givenname character varying(50),
    middlename character varying(50),
    surname character varying(50),
    organizationname character varying(100),
    currentname_id int(11),
    contactinstructions text,
    email character varying(120),
    partytype character varying(40),
    partypublic int(1) DEFAULT true,
    d_obscount int(11),
    accessioncode character varying(255)
);


--
-- Name: party_party_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: party_party_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: partymember; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE partymember (
    partymember_id int(11) NOT NULL,
    parentparty_id int(11) NOT NULL,
    childparty_id int(11) NOT NULL,
    role_id int(11),
    memberstart timestamp NULL  NOT NULL,
    memberstop timestamp NULL
);


--
-- Name: partymember_partymember_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: partymember_partymember_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: plant; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plant (
    plant_id int(11) NOT NULL
);


--
-- Name: TABLE plant; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: plant_plant_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plant_plant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: plantconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantconcept (
    plantconcept_id int(11) NOT NULL,
    plantname_id int(11) NOT NULL,
    reference_id int(11),
    plantcode character varying(23),
    plantdescription text,
    d_obscount int(11),
    d_currentaccepted int(1),
    accessioncode character varying(255)
);


--
-- Name: plantconcept_plantconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantconcept_plantconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: plantcorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantcorrelation (
    plantcorrelation_id int(11) NOT NULL,
    plantstatus_id int(11) NOT NULL,
    plantconcept_id int(11) NOT NULL,
    plantconvergence character varying(20) NOT NULL,
    correlationstart timestamp NOT NULL,
    correlationstop timestamp NULL
);


--
-- Name: plantcorrelation_plantcorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantcorrelation_plantcorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: plantlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantlineage (
    plantlineage_id int(11) NOT NULL,
    childplantstatus_id int(11) NOT NULL,
    parentplantstatus_id int(11) NOT NULL
);


--
-- Name: plantlineage_plantlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantlineage_plantlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: plantname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantname (
    plantname_id int(11) NOT NULL,
    plantname character varying(255) NOT NULL,
    reference_id int(11),
    dateentered timestamp NULL 
);


--
-- Name: plantname_plantname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantname_plantname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: plantobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantobservation (
    plantobservation_id int(11) NOT NULL,
    overallheight double precision,
    overallheightaccuracy double precision,
    emb_plantobservation int(11),
    authorplantcode character varying(20),
    accessioncode character varying(255),
    stemcount int(11),
    sourceaccessioncode character varying(100),
    plant_id int(11)
);


--
-- Name: TABLE plantobservation; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: plantstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantstatus (
    plantstatus_id int(11) NOT NULL,
    plantconcept_id int(11) NOT NULL,
    reference_id int(11),
    plantconceptstatus character varying(20) DEFAULT 'undetermined',
    plantpartycomments text,
    plantparentname character varying(200),
    plantparentconcept_id int(11),
    plantparent_id int(11),
    plantlevel character varying(80),
    party_id int(11),
    startdate timestamp NULL,
    stopdate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: plantstatus_plantstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantstatus_plantstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: planttag; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE planttag (
    planttag_id int(11) NOT NULL,
    plantobservation_id int(11) NOT NULL,
    tag character varying(255) NOT NULL,
    iscurrent int(1) DEFAULT true NOT NULL
);


--
-- Name: planttag_planttag_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: planttag_planttag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: plantusage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantusage (
    plantusage_id int(11) NOT NULL,
    plantname_id int(11) NOT NULL,
    plantconcept_id int(11),
    plantnamestatus character varying(20),
    plantname character varying(220),
    classsystem character varying(50),
    acceptedsynonym character varying(220),
    party_id int(11),
    plantstatus_id int(11),
    usagestart timestamp NULL,
    usagestop timestamp NULL
);


--
-- Name: plantusage_plantusage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: plantusage_plantusage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE project (
    project_id int(11) NOT NULL,
    projectname character varying(150) NOT NULL,
    projectdescription text,
    startdate timestamp NULL,
    stopdate timestamp NULL,
    d_obscount int(11),
    d_lastlocationaddeddate timestamp NULL,
    accessioncode character varying(255),
    reference_id int(11)
);


--
-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: projectcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE projectcontributor (
    projectcontributor_id int(11) NOT NULL,
    project_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    role_id int(11),
    surname character varying(50),
    cheatrole character varying(50)
);


--
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: reference; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE reference (
    reference_id int(11) NOT NULL,
    shortname character varying(250),
    fulltext__ text,
    referencetype character varying(250),
    title character varying(250),
    titlesuperior character varying(250),
    referencejournal_id int(11),
    volume character varying(250),
    issue character varying(250),
    pagerange character varying(250),
    totalpages int(11),
    publisher character varying(250),
    publicationplace character varying(250),
    isbn character varying(250),
    edition character varying(250),
    numberofvolumes int(11),
    chapternumber int(11),
    reportnumber int(11),
    communicationtype character varying(250),
    degree character varying(250),
    url text,
    doi text,
    additionalinfo text,
    pubdate timestamp NULL,
    accessdate timestamp NULL,
    conferencedate timestamp NULL,
    accessioncode character varying(255)
);


--
-- Name: reference_reference_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: reference_reference_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: referencealtident; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE referencealtident (
    referencealtident_id int(11) NOT NULL,
    reference_id int(11) NOT NULL,
    system character varying(250),
    identifier character varying(250) NOT NULL
);


--
-- Name: referencealtident_referencealtident_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: referencealtident_referencealtident_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: referencecontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE referencecontributor (
    referencecontributor_id int(11) NOT NULL,
    reference_id int(11) NOT NULL,
    referenceparty_id int(11) NOT NULL,
    roletype character varying(250),
    `position` int(11)
);


--
-- Name: referencecontributor_referencecontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: referencecontributor_referencecontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: referencejournal; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE referencejournal (
    referencejournal_id int(11) NOT NULL,
    journal character varying(250) NOT NULL,
    issn character varying(250),
    abbreviation character varying(250),
    accessioncode character varying(255)
);


--
-- Name: referencejournal_referencejournal_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: referencejournal_referencejournal_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: referenceparty; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE referenceparty (
    referenceparty_id int(11) NOT NULL,
    type character varying(250),
    positionname character varying(250),
    salutation character varying(250),
    givenname character varying(250),
    surname character varying(250),
    suffix character varying(250),
    organizationname character varying(250),
    currentparty_id int(11),
    accessioncode character varying(255)
);


--
-- Name: referenceparty_referenceparty_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: referenceparty_referenceparty_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: revision; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE revision (
    revision_id int(11) NOT NULL,
    tablename character varying(50) NOT NULL,
    tableattribute character varying(50) NOT NULL,
    tablerecord int(11) NOT NULL,
    previousvaluetext text NOT NULL,
    previousvaluetype character varying(20) NOT NULL,
    previousrevision_id int(11),
    revisiondate timestamp NOT NULL
);


--
-- Name: revision_revision_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: revision_revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: role; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE role (
    role_id int(11) NOT NULL,
    rolecode character varying(30) NOT NULL,
    roledescription character varying(200),
    roleproject int(11),
    roleobservation int(11),
    roletaxonint int(11),
    roleclassint int(11),
    accessioncode character varying(255)
);


--
-- Name: role_role_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: role_role_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: sizeclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE sizeclass (
    sizeclass_id int(11) NOT NULL,
    mindiameter double precision,
    minheight double precision,
    maxdiameter double precision,
    maxheight double precision,
    accessioncode character varying(255)
);


--
-- Name: TABLE sizeclass; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: sizeclass_sizeclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: sizeclass_sizeclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: soilobs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE soilobs (
    soilobs_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    soilhorizon character varying(15) NOT NULL,
    soildepthtop double precision,
    soildepthbottom double precision,
    soilcolor character varying(30),
    soilorganic double precision,
    soiltexture character varying(50),
    soilsand double precision,
    soilsilt double precision,
    soilclay double precision,
    soilcoarse double precision,
    soilph double precision,
    exchangecapacity double precision,
    basesaturation double precision,
    soildescription text,
    emb_soilobs int(11)
);


--
-- Name: soilobs_soilobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: soilobs_soilobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: soiltaxon; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE soiltaxon (
    soiltaxon_id int(11) NOT NULL,
    soilcode character varying(15),
    soilname character varying(100),
    soillevel int(11),
    soilparent_id int(11),
    soilframework character varying(33),
    accessioncode character varying(255)
);


--
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: specimen; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE specimen (
    specimen_id int(11) NOT NULL
);


--
-- Name: TABLE specimen; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: specimen_specimen_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: specimen_specimen_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE specimenreplicate (
    specimenreplicate_id int(11) NOT NULL,
    reference_id int(11) NOT NULL,
    collectioncode_dwc character varying(255),
    catalognumber_dwc character varying(255),
    collectiondate timestamp NULL,
    museum_id int(11),
    sourceaccessioncode character varying(100),
    accessioncode character varying(255),
    taxonoccurrence_id int(11) NOT NULL,
    verbatimcollectorname character varying(255),
    collectionnumber character varying(255),
    specimen_id int(11)
);


--
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: COLUMN specimenreplicate.collectionnumber; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stemobservation (
    stemobservation_id int(11) NOT NULL,
    plantobservation_id int(11) NOT NULL,
    authorstemcode character varying(20),
    xposition double precision,
    yposition double precision,
    health character varying(50),
    emb_stemobservation int(11),
    diameter double precision,
    height double precision,
    heightaccuracy double precision,
    age double precision,
    accessioncode character varying(255),
    diameteraccuracy double precision,
    sourceaccessioncode character varying(100)
);


--
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: stratum; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stratum (
    stratum_id int(11) NOT NULL,
    locationevent_id int(11) NOT NULL,
    stratumtype_id int(11) NOT NULL,
    stratumheight double precision,
    stratumbase double precision,
    stratumcover double precision,
    area double precision
);


--
-- Name: stratum_stratum_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: stratum_stratum_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: stratummethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stratummethod (
    stratummethod_id int(11) NOT NULL,
    reference_id int(11),
    stratummethodname character varying(30) NOT NULL,
    stratummethoddescription text,
    stratumassignment character varying(50),
    accessioncode character varying(255)
);


--
-- Name: stratummethod_stratummethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: stratummethod_stratummethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: stratumtype; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stratumtype (
    stratumtype_id int(11) NOT NULL,
    stratummethod_id int(11) NOT NULL,
    stratumindex character varying(10),
    stratumname character varying(30),
    stratumdescription text
);


--
-- Name: stratumtype_stratumtype_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: stratumtype_stratumtype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: taxonalt; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonalt (
    taxonalt_id int(11) NOT NULL,
    taxondetermination_id int(11) NOT NULL,
    plantconcept_id int(11) NOT NULL,
    taxonaltfit character varying(50),
    taxonaltconfidence character varying(50),
    taxonaltnotes text,
    emb_taxonalt int(11)
);


--
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxondetermination (
    taxondetermination_id int(11) NOT NULL,
    taxonoccurrence_id int(11) NOT NULL,
    plantconcept_id int(11) NOT NULL,
    party_id int(11),
    role_id int(11) NOT NULL,
    determinationtype character varying(30),
    reference_id int(11),
    isoriginal int(1) DEFAULT false NOT NULL,
    iscurrent int(1) DEFAULT false NOT NULL,
    taxonfit character varying(50),
    taxonconfidence character varying(50),
    grouptype character varying(20),
    notes text,
    notespublic int(1),
    notesmgt int(1),
    revisions int(1),
    determinationdate timestamp NULL,
    emb_taxondetermination int(11),
    accessioncode character varying(255)
);


--
-- Name: TABLE taxondetermination; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: taxonoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonoccurrence (
    taxonoccurrence_id int(11) NOT NULL,
    locationevent_id int(11),
    authorplantname character varying(255),
    reference_id int(11),
    taxoninferencearea double precision,
    emb_taxonoccurrence int(11),
    accessioncode character varying(255)
);


--
-- Name: TABLE taxonoccurrence; Type: COMMENT; Schema: public; Owner: -
--




--
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: telephone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE telephone (
    telephone_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    phonenumber character varying(30) NOT NULL,
    phonetype character varying(20) NOT NULL
);


--
-- Name: telephone_telephone_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: telephone_telephone_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: temptbl_std_commnames; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE temptbl_std_commnames (
    commconcept_id int(11) NOT NULL,
    sciname character varying(255),
    translated character varying(255),
    code character varying(255),
    common character varying(255)
);


--
-- Name: temptbl_std_commnames_commconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: temptbl_std_commnames_commconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: temptbl_std_plantnames; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE temptbl_std_plantnames (
    plantconcept_id int(11) NOT NULL,
    plantname character varying(255),
    sciname character varying(255),
    scinamenoauth character varying(255),
    code character varying(255),
    common character varying(255)
);


--
-- Name: temptbl_std_plantnames_plantconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: temptbl_std_plantnames_plantconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE trait (
    trait_id int(11) NOT NULL,
    stemobservation_id int(11) NOT NULL,
    type character varying(255) NOT NULL,
    value character varying(255)
);


--
-- Name: trait_trait_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: trait_trait_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: usercertification; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE usercertification (
    usercertification_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    current_cert_level int(11) NOT NULL,
    requested_cert_level int(11) NOT NULL,
    highest_degree character varying(50),
    degree_year character varying(50),
    degree_institution character varying(50),
    current_org character varying(50),
    current_pos character varying(200),
    esa_member int(1),
    prof_exp text,
    relevant_pubs text,
    veg_sampling_exp text,
    veg_analysis_exp text,
    usnvc_exp text,
    vb_exp text,
    vb_intention text,
    tools_exp text,
    esa_sponsor_name_a character varying(120),
    esa_sponsor_email_a character varying(120),
    esa_sponsor_name_b character varying(120),
    esa_sponsor_email_b character varying(120),
    peer_review int(1),
    addl_stmt text,
    certificationstatus character varying(30),
    certificationstatuscomments text,
    exp_region_a text,
    exp_region_b text,
    exp_region_c text,
    exp_region_a_veg text,
    exp_region_b_veg text,
    exp_region_c_veg text,
    exp_region_a_flor text,
    exp_region_b_flor text,
    exp_region_c_flor text,
    exp_region_a_nvc text,
    exp_region_b_nvc text,
    exp_region_c_nvc text
);


--
-- Name: usercertification_usercertification_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: usercertification_usercertification_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userdataset; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userdataset (
    userdataset_id int(11) NOT NULL,
    usr_id int(11),
    datasetname character varying(100) NOT NULL,
    datasetdescription text,
    datasettype character varying(50),
    datasetsharing character varying(30),
    datasetpassword character varying(50),
    datasetstop timestamp NULL,
    datasetstart timestamp NULL ,
    accessioncode character varying(255)
);


--
-- Name: userdataset_userdataset_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userdataset_userdataset_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userdatasetitem; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userdatasetitem (
    userdatasetitem_id int(11) NOT NULL,
    userdataset_id int(11) NOT NULL,
    itemaccessioncode character varying(100) NOT NULL,
    itemtype character varying(50),
    notes text,
    itemstart timestamp NULL  NOT NULL,
    itemstop timestamp NULL,
    externalaccessioncode character varying(100),
    itemdatabase character varying(50) NOT NULL,
    itemtable character varying(50) NOT NULL,
    itemrecord int(11) NOT NULL
);


--
-- Name: userdatasetitem_userdatasetitem_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userdatasetitem_userdatasetitem_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userdefined; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userdefined (
    userdefined_id int(11) NOT NULL,
    userdefinedname character varying(50),
    userdefinedmetadata text,
    userdefinedcategory character varying(30),
    userdefinedtype character varying(20) DEFAULT 'text',
    tablename character varying(50) NOT NULL,
    accessioncode character varying(255)
);


--
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: usernotify; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE usernotify (
    usernotify_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    notifyname character varying(100),
    notifydescription text,
    notifysql text,
    notifystart timestamp NULL ,
    notifystop timestamp NULL,
    lastcheckdate timestamp NULL
);


--
-- Name: usernotify_usernotify_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: usernotify_usernotify_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userpermission; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userpermission (
    userpermission_id int(11) NOT NULL,
    embargo_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    permissionstatus int(11) NOT NULL,
    permissionnotes text,
    permissionstop timestamp NULL,
    permissionstart timestamp NULL  NOT NULL
);


--
-- Name: userpermission_userpermission_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userpermission_userpermission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userpreference; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userpreference (
    userpreference_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    preferencename character varying(100),
    preferencevalue text,
    preferencepriority double precision,
    preferencestop timestamp NULL,
    preferencestart timestamp NULL 
);


--
-- Name: userpreference_userpreference_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userpreference_userpreference_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userquery; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userquery (
    userquery_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    queryname character varying(100),
    querydescription text,
    querysql text,
    querytype character varying(50),
    querysharing character varying(30),
    querypassword character varying(50),
    querystop timestamp NULL,
    querystart timestamp NULL ,
    accessioncode character varying(255)
);


--
-- Name: userquery_userquery_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userquery_userquery_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userrecordowner; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userrecordowner (
    userrecordowner_id int(11) NOT NULL,
    usr_id int(11) NOT NULL,
    tablename character varying(50) NOT NULL,
    tablerecord int(11) NOT NULL,
    ownertype character varying(30) NOT NULL,
    recordcreationdate timestamp NOT NULL,
    ownerstop timestamp NULL,
    ownerstart timestamp NULL  NOT NULL
);


--
-- Name: userrecordowner_userrecordowner_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userrecordowner_userrecordowner_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: userregionalexp; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userregionalexp (
    userregionalexp_id int(11) NOT NULL,
    usercertification_id int(11) NOT NULL,
    region character varying(50) NOT NULL,
    vegetation character varying(50),
    floristics character varying(50),
    nvc_ivc character varying(50)
);


--
-- Name: userregionalexp_userregionalexp_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: userregionalexp_userregionalexp_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: usr; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE usr (
    usr_id int(11) NOT NULL,
    party_id int(11) NOT NULL,
    permission_type int(11) NOT NULL,
    ticket_count int(11),
    email_address character varying(100) NOT NULL,
    preferred_name character varying(100),
    remote_address character varying(100),
    last_connect timestamp NULL,
    begin_time timestamp NULL,
    password character varying(512)
);


--
-- Name: usr_usr_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: usr_usr_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--






--
-- Name: voucher; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE voucher (
    voucher_id int(11) NOT NULL,
    taxonoccurrence_id int(11) NOT NULL,
    specimenreplicate_id int(11) NOT NULL,
    accessioncode character varying(255)
);


--
-- Name: voucher_voucher_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--




--
-- Name: voucher_voucher_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--




--
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: aggregateoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: classcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commclass_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commconcept_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commcorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commdetermination_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commlineage_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commname_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commstatus_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commusage_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: coverindex_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: covermethod_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: cookie_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: cookielabel_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_datacache_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_datamodelversion_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: stat_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_fielddescription_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_fieldlist_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_onerow_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_preassignacccode_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: dba_tabledescription_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: definedvalue_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: disturbanceobs_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: embargo_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: graphic_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: location_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: locationevent_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: locationeventcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: locationeventsynonym_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: locationplace_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: namedplace_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: namedplacecorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: note_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: notelink_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: party_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: partymember_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plant_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantconcept_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantcorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantlineage_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantname_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantobservation_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantstatus_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: planttag_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantusage_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: project_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: projectcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: reference_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: referencealtident_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: referencecontributor_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: referencejournal_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: referenceparty_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: revision_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: role_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: sizeclass_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: soilobs_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: soiltaxon_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: specimen_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: specimenreplicate_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: stemobservation_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: stratum_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: stratummethod_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: stratumtype_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: taxonalt_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: taxonoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: telephone_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: commconcept_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: plantconcept_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: trait_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: usercertification_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userdataset_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userdatasetitem_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userdefined_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: usernotify_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userpermission_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userpreference_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userquery_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userrecordowner_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: userregionalexp_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: usr_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: voucher_id; Type: DEFAULT; Schema: public; Owner: -
--




--
-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE address
    ADD CONSTRAINT address_pkey PRIMARY KEY (address_id);


--
-- Name: aggregateoccurrence_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_keys_accessioncode UNIQUE (taxonoccurrence_id, sourceaccessioncode);


--
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);


--
-- Name: aggregateoccurrence_taxonoccurrence_1_to_1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_taxonoccurrence_1_to_1 UNIQUE (taxonoccurrence_id);


--
-- Name: classcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE classcontributor
    ADD CONSTRAINT classcontributor_pkey PRIMARY KEY (classcontributor_id);


--
-- Name: commclass_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commclass
    ADD CONSTRAINT commclass_keys UNIQUE (locationevent_id, classnotes);


--
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commclass
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);


--
-- Name: commconcept_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commconcept
    ADD CONSTRAINT commconcept_keys UNIQUE (commname_id);


--
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commconcept
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);


--
-- Name: commcorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commcorrelation
    ADD CONSTRAINT commcorrelation_pkey PRIMARY KEY (commcorrelation_id);


--
-- Name: commdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commdetermination
    ADD CONSTRAINT commdetermination_keys UNIQUE (commclass_id, commconcept_id);


--
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commdetermination
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);


--
-- Name: commlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commlineage
    ADD CONSTRAINT commlineage_pkey PRIMARY KEY (commlineage_id);


--
-- Name: commname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commname
    ADD CONSTRAINT commname_keys UNIQUE (commname);


--
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commname
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);


--
-- Name: commstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commstatus
    ADD CONSTRAINT commstatus_pkey PRIMARY KEY (commstatus_id);


--
-- Name: commusage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE commusage
    ADD CONSTRAINT commusage_pkey PRIMARY KEY (commusage_id);


--
-- Name: coverindex_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE coverindex
    ADD CONSTRAINT coverindex_pkey PRIMARY KEY (coverindex_id);


--
-- Name: covermethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE covermethod
    ADD CONSTRAINT covermethod_pkey PRIMARY KEY (covermethod_id);


--
-- Name: dba_confidentialitystatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_confidentialitystatus
    ADD CONSTRAINT dba_confidentialitystatus_pkey PRIMARY KEY (confidentialitystatus);


--
-- Name: dba_cookie_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_cookie
    ADD CONSTRAINT dba_cookie_pkey PRIMARY KEY (cookie_id);


--
-- Name: dba_cookielabels_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_cookielabels
    ADD CONSTRAINT dba_cookielabels_pkey PRIMARY KEY (vieworcookie);


--
-- Name: dba_datacache_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_datacache
    ADD CONSTRAINT dba_datacache_pkey PRIMARY KEY (dba_datacache_id);


--
-- Name: dba_datamodelversion_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_datamodelversion
    ADD CONSTRAINT dba_datamodelversion_pkey PRIMARY KEY (dba_datamodelversion_id);


--
-- Name: dba_dbstatstime_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_dbstatstime
    ADD CONSTRAINT dba_dbstatstime_pkey PRIMARY KEY (stat_id);


--
-- Name: dba_fielddescription_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_fielddescription
    ADD CONSTRAINT dba_fielddescription_pkey PRIMARY KEY (dba_fielddescription_id);


--
-- Name: dba_fieldlist_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_fieldlist
    ADD CONSTRAINT dba_fieldlist_pkey PRIMARY KEY (dba_fieldlist_id);


--
-- Name: dba_onerow_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_onerow
    ADD CONSTRAINT dba_onerow_pkey PRIMARY KEY (dba_onerow_id);


--
-- Name: dba_preassignacccode_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_preassignacccode
    ADD CONSTRAINT dba_preassignacccode_pkey PRIMARY KEY (dba_preassignacccode_id);


--
-- Name: dba_tabledescription_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE dba_tabledescription
    ADD CONSTRAINT dba_tabledescription_pkey PRIMARY KEY (dba_tabledescription_id);


--
-- Name: definedvalue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE definedvalue
    ADD CONSTRAINT definedvalue_pkey PRIMARY KEY (definedvalue_id);


--
-- Name: disturbanceobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE disturbanceobs
    ADD CONSTRAINT disturbanceobs_pkey PRIMARY KEY (disturbanceobs_id);


--
-- Name: embargo_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE embargo
    ADD CONSTRAINT embargo_pkey PRIMARY KEY (embargo_id);


--
-- Name: graphic_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE graphic
    ADD CONSTRAINT graphic_pkey PRIMARY KEY (graphic_id);


--
-- Name: location_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE location
    ADD CONSTRAINT location_keys_code UNIQUE (reference_id, authorlocationcode);


--
-- Name: location_keys_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE location
    ADD CONSTRAINT location_keys_coords UNIQUE (reference_id, reallatitude, reallongitude);


--
-- Name: location_keys_subplot_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE location
    ADD CONSTRAINT location_keys_subplot_code UNIQUE (parent_id, authorlocationcode);


--
-- Name: location_keys_subplot_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE location
    ADD CONSTRAINT location_keys_subplot_coords UNIQUE (parent_id, sublocationxposition, sublocationyposition);


--
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE location
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);


--
-- Name: locationevent_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_keys_accessioncode UNIQUE (location_id, project_id, sourceaccessioncode);


--
-- Name: locationevent_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_keys_code UNIQUE (location_id, project_id, authoreventcode);


--
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);


--
-- Name: locationeventcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_pkey PRIMARY KEY (locationeventcontributor_id);


--
-- Name: locationeventsynonym_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_pkey PRIMARY KEY (locationeventsynonym_id);


--
-- Name: locationplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationplace
    ADD CONSTRAINT locationplace_keys UNIQUE (location_id, namedplace_id);


--
-- Name: locationplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE locationplace
    ADD CONSTRAINT locationplace_pkey PRIMARY KEY (locationplace_id);


--
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE namedplace
    ADD CONSTRAINT namedplace_keys UNIQUE (placesystem, placename);


--
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE namedplace
    ADD CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id);


--
-- Name: namedplacecorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE namedplacecorrelation
    ADD CONSTRAINT namedplacecorrelation_pkey PRIMARY KEY (namedplacecorrelation_id);


--
-- Name: note_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE note
    ADD CONSTRAINT note_pkey PRIMARY KEY (note_id);


--
-- Name: notelink_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE notelink
    ADD CONSTRAINT notelink_pkey PRIMARY KEY (notelink_id);


--
-- Name: party_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE party
    ADD CONSTRAINT party_keys UNIQUE (givenname, middlename, surname, organizationname);


--
-- Name: party_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE party
    ADD CONSTRAINT party_pkey PRIMARY KEY (party_id);


--
-- Name: partymember_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE partymember
    ADD CONSTRAINT partymember_pkey PRIMARY KEY (partymember_id);


--
-- Name: plant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plant
    ADD CONSTRAINT plant_pkey PRIMARY KEY (plant_id);


--
-- Name: plantconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantconcept
    ADD CONSTRAINT plantconcept_pkey PRIMARY KEY (plantconcept_id);


--
-- Name: plantcorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantcorrelation
    ADD CONSTRAINT plantcorrelation_pkey PRIMARY KEY (plantcorrelation_id);


--
-- Name: plantlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantlineage
    ADD CONSTRAINT plantlineage_pkey PRIMARY KEY (plantlineage_id);


--
-- Name: plantname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantname
    ADD CONSTRAINT plantname_pkey PRIMARY KEY (plantname_id);


--
-- Name: plantobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantobservation
    ADD CONSTRAINT plantobservation_pkey PRIMARY KEY (plantobservation_id);


--
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantstatus
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);


--
-- Name: planttag_current_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE planttag
    ADD CONSTRAINT planttag_current_unique UNIQUE (plantobservation_id, iscurrent);


--
-- Name: planttag_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE planttag
    ADD CONSTRAINT planttag_keys UNIQUE (plantobservation_id, tag);


--
-- Name: planttag_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE planttag
    ADD CONSTRAINT planttag_pkey PRIMARY KEY (planttag_id);


--
-- Name: plantusage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE plantusage
    ADD CONSTRAINT plantusage_pkey PRIMARY KEY (plantusage_id);


--
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE project
    ADD CONSTRAINT project_keys UNIQUE (reference_id, projectname);


--
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE project
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);


--
-- Name: projectcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE projectcontributor
    ADD CONSTRAINT projectcontributor_pkey PRIMARY KEY (projectcontributor_id);


--
-- Name: reference_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE reference
    ADD CONSTRAINT reference_pkey PRIMARY KEY (reference_id);


--
-- Name: referencealtident_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE referencealtident
    ADD CONSTRAINT referencealtident_pkey PRIMARY KEY (referencealtident_id);


--
-- Name: referencecontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE referencecontributor
    ADD CONSTRAINT referencecontributor_pkey PRIMARY KEY (referencecontributor_id);


--
-- Name: referencejournal_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE referencejournal
    ADD CONSTRAINT referencejournal_pkey PRIMARY KEY (referencejournal_id);


--
-- Name: referenceparty_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE referenceparty
    ADD CONSTRAINT referenceparty_pkey PRIMARY KEY (referenceparty_id);


--
-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE revision
    ADD CONSTRAINT revision_pkey PRIMARY KEY (revision_id);


--
-- Name: role_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE role
    ADD CONSTRAINT role_pkey PRIMARY KEY (role_id);


--
-- Name: sizeclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE sizeclass
    ADD CONSTRAINT sizeclass_pkey PRIMARY KEY (sizeclass_id);


--
-- Name: soilobs_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE soilobs
    ADD CONSTRAINT soilobs_keys UNIQUE (locationevent_id);


--
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE soilobs
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);


--
-- Name: soiltaxon_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE soiltaxon
    ADD CONSTRAINT soiltaxon_pkey PRIMARY KEY (soiltaxon_id);


--
-- Name: specimen_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE specimen
    ADD CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id);


--
-- Name: specimenreplicate_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_keys_accessioncode UNIQUE (reference_id, collectioncode_dwc, sourceaccessioncode);


--
-- Name: specimenreplicate_keys_catalognumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_keys_catalognumber UNIQUE (reference_id, collectioncode_dwc, catalognumber_dwc);


--
-- Name: specimenreplicate_keys_collectionnumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_keys_collectionnumber UNIQUE (reference_id, collectioncode_dwc, collectionnumber);


--
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);


--
-- Name: stemobservation_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stemobservation
    ADD CONSTRAINT stemobservation_keys_accessioncode UNIQUE (plantobservation_id, sourceaccessioncode);


--
-- Name: stemobservation_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stemobservation
    ADD CONSTRAINT stemobservation_keys_code UNIQUE (plantobservation_id, authorstemcode);


--
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stemobservation
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);


--
-- Name: stratum_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stratum
    ADD CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id);


--
-- Name: stratummethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stratummethod
    ADD CONSTRAINT stratummethod_pkey PRIMARY KEY (stratummethod_id);


--
-- Name: stratumtype_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE stratumtype
    ADD CONSTRAINT stratumtype_pkey PRIMARY KEY (stratumtype_id);


--
-- Name: taxonalt_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE taxonalt
    ADD CONSTRAINT taxonalt_pkey PRIMARY KEY (taxonalt_id);


--
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE taxondetermination
    ADD CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id);


--
-- Name: taxonoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id);


--
-- Name: telephone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE telephone
    ADD CONSTRAINT telephone_pkey PRIMARY KEY (telephone_id);


--
-- Name: temptbl_std_commnames_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE temptbl_std_commnames
    ADD CONSTRAINT temptbl_std_commnames_pkey PRIMARY KEY (commconcept_id);


--
-- Name: temptbl_std_plantnames_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE temptbl_std_plantnames
    ADD CONSTRAINT temptbl_std_plantnames_pkey PRIMARY KEY (plantconcept_id);


--
-- Name: trait_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE trait
    ADD CONSTRAINT trait_pkey PRIMARY KEY (trait_id);


--
-- Name: usercertification_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE usercertification
    ADD CONSTRAINT usercertification_pkey PRIMARY KEY (usercertification_id);


--
-- Name: userdataset_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userdataset
    ADD CONSTRAINT userdataset_pkey PRIMARY KEY (userdataset_id);


--
-- Name: userdatasetitem_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userdatasetitem
    ADD CONSTRAINT userdatasetitem_pkey PRIMARY KEY (userdatasetitem_id);


--
-- Name: userdatasetitem_userdataset_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userdatasetitem
    ADD CONSTRAINT userdatasetitem_userdataset_id_key UNIQUE (userdataset_id, itemaccessioncode);


--
-- Name: userdefined_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userdefined
    ADD CONSTRAINT userdefined_pkey PRIMARY KEY (userdefined_id);


--
-- Name: usernotify_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE usernotify
    ADD CONSTRAINT usernotify_pkey PRIMARY KEY (usernotify_id);


--
-- Name: userpermission_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userpermission
    ADD CONSTRAINT userpermission_pkey PRIMARY KEY (userpermission_id);


--
-- Name: userpreference_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userpreference
    ADD CONSTRAINT userpreference_pkey PRIMARY KEY (userpreference_id);


--
-- Name: userquery_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userquery
    ADD CONSTRAINT userquery_pkey PRIMARY KEY (userquery_id);


--
-- Name: userrecordowner_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userrecordowner
    ADD CONSTRAINT userrecordowner_pkey PRIMARY KEY (userrecordowner_id);


--
-- Name: userregionalexp_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE userregionalexp
    ADD CONSTRAINT userregionalexp_pkey PRIMARY KEY (userregionalexp_id);


--
-- Name: usr_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE usr
    ADD CONSTRAINT usr_pkey PRIMARY KEY (usr_id);


--
-- Name: voucher_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE voucher
    ADD CONSTRAINT voucher_keys UNIQUE (taxonoccurrence_id, specimenreplicate_id);


--
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE voucher
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);


--
-- Name: address_organization_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_organization_id_x ON address  (organization_id);


--
-- Name: address_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_party_id_x ON address  (party_id);


--
-- Name: aggregateoccurrence_taxonoccurrence_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_taxonoccurrence_id_x ON aggregateoccurrence  (taxonoccurrence_id);


--
-- Name: classcontributor_commclass_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX classcontributor_commclass_id_x ON classcontributor  (commclass_id);


--
-- Name: classcontributor_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX classcontributor_party_id_x ON classcontributor  (party_id);


--
-- Name: classcontributor_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX classcontributor_role_id_x ON classcontributor  (role_id);


--
-- Name: commclass_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX commclass_accessioncode_index ON commclass  (accessioncode);


--
-- Name: commclass_classpublication_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commclass_classpublication_id_x ON commclass  (classpublication_id);


--
-- Name: commclass_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commclass_locationevent_id_x ON commclass  (locationevent_id);


--
-- Name: commconcept_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX commconcept_accessioncode_index ON commconcept  (accessioncode);


--
-- Name: commconcept_commname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commconcept_commname_id_x ON commconcept  (commname_id);


--
-- Name: commconcept_dobscount_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commconcept_dobscount_x ON commconcept  (d_obscount);


--
-- Name: commconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commconcept_reference_id_x ON commconcept  (reference_id);


--
-- Name: commcorrelation_commconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commcorrelation_commconcept_id_x ON commcorrelation  (commconcept_id);


--
-- Name: commcorrelation_commstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commcorrelation_commstatus_id_x ON commcorrelation  (commstatus_id);


--
-- Name: commdetermination_commauthority_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commdetermination_commauthority_id_x ON commdetermination  (commauthority_id);


--
-- Name: commdetermination_commclass_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commdetermination_commclass_id_x ON commdetermination  (commclass_id);


--
-- Name: commdetermination_commconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commdetermination_commconcept_id_x ON commdetermination  (commconcept_id);


--
-- Name: commlineage_childcommstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commlineage_childcommstatus_id_x ON commlineage  (childcommstatus_id);


--
-- Name: commlineage_parentcommstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commlineage_parentcommstatus_id_x ON commlineage  (parentcommstatus_id);


--
-- Name: commname_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commname_reference_id_x ON commname  (reference_id);


--
-- Name: commstatus_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX commstatus_accessioncode_index ON commstatus  (accessioncode);


--
-- Name: commstatus_commconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_commconcept_id_x ON commstatus  (commconcept_id);


--
-- Name: commstatus_commlevel_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_commlevel_x ON commstatus  (commlevel);


--
-- Name: commstatus_commparent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_commparent_id_x ON commstatus  (commparent_id);


--
-- Name: commstatus_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_party_id_x ON commstatus  (party_id);


--
-- Name: commstatus_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_reference_id_x ON commstatus  (reference_id);


--
-- Name: commusage_classsystem_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_classsystem_x ON commusage  (classsystem);


--
-- Name: commusage_commconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commconcept_id_x ON commusage  (commconcept_id);


--
-- Name: commusage_commname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commname_id_x ON commusage  (commname_id);


--
-- Name: commusage_commname_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commname_x ON commusage  (commname);


--
-- Name: commusage_commstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commstatus_id_x ON commusage  (commstatus_id);


--
-- Name: commusage_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_party_id_x ON commusage  (party_id);


--
-- Name: coverindex_covermethod_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX coverindex_covermethod_id_x ON coverindex  (covermethod_id);


--
-- Name: covermethod_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX covermethod_accessioncode_index ON covermethod  (accessioncode);


--
-- Name: covermethod_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX covermethod_reference_id_x ON covermethod  (reference_id);


--
-- Name: dba_datacache_key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX dba_datacache_key ON dba_datacache  (cache_key);


--
-- Name: definedvalue_userdefined_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX definedvalue_userdefined_id_x ON definedvalue  (userdefined_id);


--
-- Name: disturbanceobs_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX disturbanceobs_locationevent_id_x ON disturbanceobs  (locationevent_id);


--
-- Name: emb_aggregateoccurrence_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_aggregateoccurrence_idx ON aggregateoccurrence  (emb_aggregateoccurrence);


--
-- Name: emb_classcontributor_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_classcontributor_idx ON classcontributor  (emb_classcontributor);


--
-- Name: emb_commclass_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_commclass_idx ON commclass  (emb_commclass);


--
-- Name: emb_commdetermination_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_commdetermination_idx ON commdetermination  (emb_commdetermination);


--
-- Name: emb_disturbanceobs_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_disturbanceobs_idx ON disturbanceobs  (emb_disturbanceobs);


--
-- Name: emb_location_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_location_idx ON location  (emb_location);


--
-- Name: emb_locationevent_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_locationevent_idx ON locationevent  (emb_locationevent);


--
-- Name: emb_plantobservation_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_plantobservation_idx ON plantobservation  (emb_plantobservation);


--
-- Name: emb_soilobs_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_soilobs_idx ON soilobs  (emb_soilobs);


--
-- Name: emb_stemobservation_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_stemobservation_idx ON stemobservation  (emb_stemobservation);


--
-- Name: emb_taxonalt_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_taxonalt_idx ON taxonalt  (emb_taxonalt);


--
-- Name: emb_taxondetermination_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_taxondetermination_idx ON taxondetermination  (emb_taxondetermination);


--
-- Name: emb_taxonoccurrence_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_taxonoccurrence_idx ON taxonoccurrence  (emb_taxonoccurrence);


--
-- Name: embargo_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX embargo_location_id_x ON embargo  (location_id);


--
-- Name: fki_aggregateoccurrence_plantobservation_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_aggregateoccurrence_plantobservation_id ON aggregateoccurrence  (plantobservation_id);


--
-- Name: fki_aggregateoccurrence_stratum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_aggregateoccurrence_stratum_id ON aggregateoccurrence  (stratum_id);


--
-- Name: fki_plantobservation_plant_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_plantobservation_plant_id ON plantobservation  (plant_id);


--
-- Name: fki_planttag_plant_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_planttag_plant_id ON planttag  (plantobservation_id);


--
-- Name: fki_planttag_plantobservation_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_planttag_plantobservation_id ON planttag  (plantobservation_id);


--
-- Name: fki_specimenreplicate_museum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_specimenreplicate_museum_id ON specimenreplicate  (museum_id);


--
-- Name: fki_specimenreplicate_reference_id_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_specimenreplicate_reference_id_fkey ON specimenreplicate  (reference_id);


--
-- Name: fki_specimenreplicate_specimen_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_specimenreplicate_specimen_id ON specimenreplicate  (specimen_id);


--
-- Name: graphic_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX graphic_accessioncode_index ON graphic  (accessioncode);


--
-- Name: graphic_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX graphic_locationevent_id_x ON graphic  (locationevent_id);


--
-- Name: keywords_table_id_entity_key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX keywords_table_id_entity_key ON keywords  (table_id, entity);


--
-- Name: location_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX location_accessioncode_index ON location  (accessioncode);


--
-- Name: location_parent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX location_parent_id_x ON location  (parent_id);


--
-- Name: location_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX location_reference_id_x ON location  (reference_id);


--
-- Name: locationevent_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_accessioncode_index ON locationevent  (accessioncode);


--
-- Name: locationevent_covermethod_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_covermethod_id_x ON locationevent  (covermethod_id);


--
-- Name: locationevent_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_location_id_x ON locationevent  (location_id);


--
-- Name: locationevent_previousobs_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_previousobs_id_x ON locationevent  (previous_id);


--
-- Name: locationevent_project_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_project_id_x ON locationevent  (project_id);


--
-- Name: locationevent_soiltaxon_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_soiltaxon_id_x ON locationevent  (soiltaxon_id);


--
-- Name: locationeventcontributor_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventcontributor_locationevent_id_x ON locationeventcontributor  (locationevent_id);


--
-- Name: locationeventcontributor_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventcontributor_party_id_x ON locationeventcontributor  (party_id);


--
-- Name: locationeventcontributor_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventcontributor_role_id_x ON locationeventcontributor  (role_id);


--
-- Name: locationeventsynonym_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationeventsynonym_accessioncode_index ON locationeventsynonym  (accessioncode);


--
-- Name: locationeventsynonym_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_party_id_x ON locationeventsynonym  (party_id);


--
-- Name: locationeventsynonym_primarylocationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_primarylocationevent_id_x ON locationeventsynonym  (primarylocationevent_id);


--
-- Name: locationeventsynonym_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_role_id_x ON locationeventsynonym  (role_id);


--
-- Name: locationeventsynonym_synonymlocationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_synonymlocationevent_id_x ON locationeventsynonym  (synonymlocationevent_id);


--
-- Name: locationplace_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationplace_location_id_x ON locationplace  (location_id);


--
-- Name: locationplace_namedplace_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationplace_namedplace_id_x ON locationplace  (namedplace_id);


--
-- Name: namedplace_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX namedplace_accessioncode_index ON namedplace  (accessioncode);


--
-- Name: namedplace_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX namedplace_reference_id_x ON namedplace  (reference_id);


--
-- Name: note_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX note_accessioncode_index ON note  (accessioncode);


--
-- Name: note_notelink_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX note_notelink_id_x ON note  (notelink_id);


--
-- Name: note_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX note_party_id_x ON note  (party_id);


--
-- Name: note_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX note_role_id_x ON note  (role_id);


--
-- Name: party_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX party_accessioncode_index ON party  (accessioncode);


--
-- Name: party_currentname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX party_currentname_id_x ON party  (currentname_id);


--
-- Name: partymember_childparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX partymember_childparty_id_x ON partymember  (childparty_id);


--
-- Name: partymember_parentparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX partymember_parentparty_id_x ON partymember  (parentparty_id);


--
-- Name: partymember_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX partymember_role_id_x ON partymember  (role_id);


--
-- Name: plantconcept_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX plantconcept_accessioncode_index ON plantconcept  (accessioncode);


--
-- Name: plantconcept_dobscount_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantconcept_dobscount_x ON plantconcept  (d_obscount);


--
-- Name: plantconcept_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--




--
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantconcept_plantname_id_x ON plantconcept  (plantname_id);


--
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantconcept_reference_id_x ON plantconcept  (reference_id);


--
-- Name: plantcorrelation_plantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantcorrelation_plantconcept_id_x ON plantcorrelation  (plantconcept_id);


--
-- Name: plantcorrelation_plantstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantcorrelation_plantstatus_id_x ON plantcorrelation  (plantstatus_id);


--
-- Name: plantlineage_childplantstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantlineage_childplantstatus_id_x ON plantlineage  (childplantstatus_id);


--
-- Name: plantlineage_parentplantstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantlineage_parentplantstatus_id_x ON plantlineage  (parentplantstatus_id);


--
-- Name: plantname_plantname_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantname_plantname_x ON plantname  (plantname);


--
-- Name: plantname_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantname_reference_id_x ON plantname  (reference_id);


--
-- Name: plantstatus_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX plantstatus_accessioncode_index ON plantstatus  (accessioncode);


--
-- Name: plantstatus_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantstatus_party_id_x ON plantstatus  (party_id);


--
-- Name: plantstatus_plantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantstatus_plantconcept_id_x ON plantstatus  (plantconcept_id);


--
-- Name: plantstatus_plantlevel_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantstatus_plantlevel_x ON plantstatus  (plantlevel);


--
-- Name: plantstatus_plantparent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantstatus_plantparent_id_x ON plantstatus  (plantparent_id);


--
-- Name: plantstatus_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantstatus_reference_id_x ON plantstatus  (reference_id);


--
-- Name: plantusage_classsystem_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_classsystem_x ON plantusage  (classsystem);


--
-- Name: plantusage_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_party_id_x ON plantusage  (party_id);


--
-- Name: plantusage_plantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_plantconcept_id_x ON plantusage  (plantconcept_id);


--
-- Name: plantusage_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_plantname_id_x ON plantusage  (plantname_id);


--
-- Name: plantusage_plantname_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_plantname_x ON plantusage  (plantname);


--
-- Name: plantusage_plantstatus_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantusage_plantstatus_id_x ON plantusage  (plantstatus_id);


--
-- Name: project_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX project_accessioncode_index ON project  (accessioncode);


--
-- Name: projectcontributor_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX projectcontributor_party_id_x ON projectcontributor  (party_id);


--
-- Name: projectcontributor_project_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX projectcontributor_project_id_x ON projectcontributor  (project_id);


--
-- Name: projectcontributor_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX projectcontributor_role_id_x ON projectcontributor  (role_id);


--
-- Name: reference_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX reference_accessioncode_index ON reference  (accessioncode);


--
-- Name: reference_referencejournal_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX reference_referencejournal_id_x ON reference  (referencejournal_id);


--
-- Name: referencealtident_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX referencealtident_reference_id_x ON referencealtident  (reference_id);


--
-- Name: referencecontributor_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX referencecontributor_reference_id_x ON referencecontributor  (reference_id);


--
-- Name: referencecontributor_referenceparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX referencecontributor_referenceparty_id_x ON referencecontributor  (referenceparty_id);


--
-- Name: referencejournal_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX referencejournal_accessioncode_index ON referencejournal  (accessioncode);


--
-- Name: referenceparty_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX referenceparty_accessioncode_index ON referenceparty  (accessioncode);


--
-- Name: referenceparty_currentparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX referenceparty_currentparty_id_x ON referenceparty  (currentparty_id);


--
-- Name: revision_previousrevision_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revision_previousrevision_id_x ON revision  (previousrevision_id);


--
-- Name: role_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX role_accessioncode_index ON role  (accessioncode);


--
-- Name: soilobs_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX soilobs_locationevent_id_x ON soilobs  (locationevent_id);


--
-- Name: soiltaxon_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX soiltaxon_accessioncode_index ON soiltaxon  (accessioncode);


--
-- Name: soiltaxon_soilparent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX soiltaxon_soilparent_id_x ON soiltaxon  (soilparent_id);


--
-- Name: stemobservation_plantobservation_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stemobservation_plantobservation_id_x ON stemobservation  (plantobservation_id);


--
-- Name: stratum_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stratum_locationevent_id_x ON stratum  (locationevent_id);


--
-- Name: stratum_stratumtype_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stratum_stratumtype_id_x ON stratum  (stratumtype_id);


--
-- Name: stratummethod_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX stratummethod_accessioncode_index ON stratummethod  (accessioncode);


--
-- Name: stratummethod_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stratummethod_reference_id_x ON stratummethod  (reference_id);


--
-- Name: stratumtype_stratummethod_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stratumtype_stratummethod_id_x ON stratumtype  (stratummethod_id);


--
-- Name: taxonalt_plantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonalt_plantconcept_id_x ON taxonalt  (plantconcept_id);


--
-- Name: taxonalt_taxondetermination_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonalt_taxondetermination_id_x ON taxonalt  (taxondetermination_id);


--
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination  (accessioncode);


--
-- Name: taxondetermination_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--




--
-- Name: taxondetermination_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_party_id_x ON taxondetermination  (party_id);


--
-- Name: taxondetermination_plantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_plantconcept_id_x ON taxondetermination  (plantconcept_id);


--
-- Name: taxondetermination_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_reference_id_x ON taxondetermination  (reference_id);


--
-- Name: taxondetermination_role_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_role_id_x ON taxondetermination  (role_id);


--
-- Name: taxondetermination_taxonoccurrence_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_taxonoccurrence_id_x ON taxondetermination  (taxonoccurrence_id);


--
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonoccurrence_accessioncode_index ON taxonoccurrence  (accessioncode);


--
-- Name: taxonoccurrence_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_locationevent_id_x ON taxonoccurrence  (locationevent_id);


--
-- Name: taxonoccurrence_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_reference_id_x ON taxonoccurrence  (reference_id);


--
-- Name: telephone_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX telephone_party_id_x ON telephone  (party_id);


--
-- Name: usercertification_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX usercertification_usr_id_x ON usercertification  (usr_id);


--
-- Name: userdataset_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX userdataset_accessioncode_index ON userdataset  (accessioncode);


--
-- Name: userdataset_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userdataset_usr_id_x ON userdataset  (usr_id);


--
-- Name: userdatasetitem2_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userdatasetitem2_accessioncode_index ON userdatasetitem  (externalaccessioncode);


--
-- Name: userdatasetitem_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userdatasetitem_accessioncode_index ON userdatasetitem  (itemaccessioncode);


--
-- Name: userdatasetitem_userdataset_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userdatasetitem_userdataset_id_x ON userdatasetitem  (userdataset_id);


--
-- Name: userdefined_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX userdefined_accessioncode_index ON userdefined  (accessioncode);


--
-- Name: usernotify_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX usernotify_usr_id_x ON usernotify  (usr_id);


--
-- Name: userpermission_embargo_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userpermission_embargo_id_x ON userpermission  (embargo_id);


--
-- Name: userpermission_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userpermission_usr_id_x ON userpermission  (usr_id);


--
-- Name: userpreference_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userpreference_usr_id_x ON userpreference  (usr_id);


--
-- Name: userquery_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX userquery_accessioncode_index ON userquery  (accessioncode);


--
-- Name: userquery_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userquery_usr_id_x ON userquery  (usr_id);


--
-- Name: userrecordowner_usr_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userrecordowner_usr_id_x ON userrecordowner  (usr_id);


--
-- Name: userregionalexp_usercertification_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX userregionalexp_usercertification_id_x ON userregionalexp  (usercertification_id);


--
-- Name: usr_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX usr_party_id_x ON usr  (party_id);


--
-- Name: aggregateoccurrence_plantobs_count_1; Type: TRIGGER; Schema: public; Owner: -
--




--
-- Name: address_organization_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE address
    ADD CONSTRAINT address_organization_id FOREIGN KEY (organization_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: address_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE address
    ADD CONSTRAINT address_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_plantobservation_id FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_sizeclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_sizeclass_id FOREIGN KEY (sizeclass_id) REFERENCES sizeclass(sizeclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_stratum_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_taxonoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: classcontributor_commclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE classcontributor
    ADD CONSTRAINT classcontributor_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: classcontributor_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: classcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE classcontributor
    ADD CONSTRAINT classcontributor_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commclass_classpublication_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commclass_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commclass
    ADD CONSTRAINT commclass_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commconcept_commname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commconcept
    ADD CONSTRAINT commconcept_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commconcept_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commcorrelation_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commcorrelation
    ADD CONSTRAINT commcorrelation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commcorrelation_commstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commcorrelation
    ADD CONSTRAINT commcorrelation_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commauthority_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commdetermination_commclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commdetermination
    ADD CONSTRAINT commdetermination_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commdetermination
    ADD CONSTRAINT commdetermination_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commlineage_childcommstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commlineage
    ADD CONSTRAINT commlineage_childcommstatus_id FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commlineage_parentcommstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commlineage
    ADD CONSTRAINT commlineage_parentcommstatus_id FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commname_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commstatus_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commstatus
    ADD CONSTRAINT commstatus_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_commparent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commstatus
    ADD CONSTRAINT commstatus_commparent_id FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commstatus_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: commusage_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commusage
    ADD CONSTRAINT commusage_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commusage
    ADD CONSTRAINT commusage_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE commusage
    ADD CONSTRAINT commusage_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: coverindex_covermethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE coverindex
    ADD CONSTRAINT coverindex_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: covermethod_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: definedvalue_userdefined_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE definedvalue
    ADD CONSTRAINT definedvalue_userdefined_id FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: disturbanceobs_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE disturbanceobs
    ADD CONSTRAINT disturbanceobs_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: embargo_location_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE embargo
    ADD CONSTRAINT embargo_location_id FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: graphic_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE graphic
    ADD CONSTRAINT graphic_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: location_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE location
    ADD CONSTRAINT location_parent_id FOREIGN KEY (parent_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: location_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: locationevent_covermethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_location_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_location_id FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_previousobs_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_previousobs_id FOREIGN KEY (previous_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_project_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_soiltaxon_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationevent
    ADD CONSTRAINT locationevent_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventcontributor_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventcontributor_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: locationeventcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: locationeventsynonym_primarylocationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_primarylocationevent_id FOREIGN KEY (primarylocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_synonymlocationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_synonymlocationevent_id FOREIGN KEY (synonymlocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationplace_location_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationplace
    ADD CONSTRAINT locationplace_location_id FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationplace_namedplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE locationplace
    ADD CONSTRAINT locationplace_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: namedplace_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: namedplacecorrelation_childplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE namedplacecorrelation
    ADD CONSTRAINT namedplacecorrelation_childplace_id FOREIGN KEY (childplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: namedplacecorrelation_parentplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE namedplacecorrelation
    ADD CONSTRAINT namedplacecorrelation_parentplace_id FOREIGN KEY (parentplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: note_notelink_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE note
    ADD CONSTRAINT note_notelink_id FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: note_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: note_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE note
    ADD CONSTRAINT note_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: party_currentname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE party
    ADD CONSTRAINT party_currentname_id FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: partymember_childparty_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE partymember
    ADD CONSTRAINT partymember_childparty_id FOREIGN KEY (childparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: partymember_parentparty_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE partymember
    ADD CONSTRAINT partymember_parentparty_id FOREIGN KEY (parentparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: partymember_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE partymember
    ADD CONSTRAINT partymember_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantconcept_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantconcept
    ADD CONSTRAINT plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantconcept_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: plantcorrelation_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantcorrelation
    ADD CONSTRAINT plantcorrelation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantcorrelation_plantstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantcorrelation
    ADD CONSTRAINT plantcorrelation_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantlineage_childplantstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantlineage
    ADD CONSTRAINT plantlineage_childplantstatus_id FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantlineage_parentplantstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantlineage
    ADD CONSTRAINT plantlineage_parentplantstatus_id FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantname_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: plantobservation_plant_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantobservation
    ADD CONSTRAINT plantobservation_plant_id FOREIGN KEY (plant_id) REFERENCES plant(plant_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantstatus_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: plantstatus_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantstatus
    ADD CONSTRAINT plantstatus_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantstatus_plantparent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantstatus
    ADD CONSTRAINT plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantstatus_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: planttag_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE planttag
    ADD CONSTRAINT planttag_plantobservation_id FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantusage_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: plantusage_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantusage
    ADD CONSTRAINT plantusage_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantusage_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantusage
    ADD CONSTRAINT plantusage_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantusage_plantstatus_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE plantusage
    ADD CONSTRAINT plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: project_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: projectcontributor_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: projectcontributor_project_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE projectcontributor
    ADD CONSTRAINT projectcontributor_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: projectcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE projectcontributor
    ADD CONSTRAINT projectcontributor_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: reference_referencejournal_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE reference
    ADD CONSTRAINT reference_referencejournal_id FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: referencealtident_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE referencealtident
    ADD CONSTRAINT referencealtident_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: referencecontributor_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE referencecontributor
    ADD CONSTRAINT referencecontributor_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: referencecontributor_referenceparty_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE referencecontributor
    ADD CONSTRAINT referencecontributor_referenceparty_id FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: referenceparty_currentparty_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE referenceparty
    ADD CONSTRAINT referenceparty_currentparty_id FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: revision_previousrevision_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE revision
    ADD CONSTRAINT revision_previousrevision_id FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: soilobs_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE soilobs
    ADD CONSTRAINT soilobs_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: soiltaxon_soilparent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE soiltaxon
    ADD CONSTRAINT soiltaxon_soilparent_id FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_museum_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: specimenreplicate_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: specimenreplicate_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_specimen_id FOREIGN KEY (specimen_id) REFERENCES specimen(specimen_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_taxonoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE specimenreplicate
    ADD CONSTRAINT specimenreplicate_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stemobservation_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE stemobservation
    ADD CONSTRAINT stemobservation_plantobservation_id FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE stratum
    ADD CONSTRAINT stratum_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_stratumtype_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE stratum
    ADD CONSTRAINT stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratummethod_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: stratumtype_stratummethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE stratumtype
    ADD CONSTRAINT stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonalt_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxonalt
    ADD CONSTRAINT taxonalt_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonalt_taxondetermination_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxonalt
    ADD CONSTRAINT taxonalt_taxondetermination_id FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: taxondetermination_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxondetermination
    ADD CONSTRAINT taxondetermination_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: taxondetermination_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxondetermination
    ADD CONSTRAINT taxondetermination_role_id FOREIGN KEY (role_id) REFERENCES role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_taxonoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxondetermination
    ADD CONSTRAINT taxondetermination_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonoccurrence_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonoccurrence_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: telephone_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE telephone
    ADD CONSTRAINT telephone_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: trait_stemobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE trait
    ADD CONSTRAINT trait_stemobservation_id_fkey FOREIGN KEY (stemobservation_id) REFERENCES stemobservation(stemobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: usercertification_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE usercertification
    ADD CONSTRAINT usercertification_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userdataset_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userdataset
    ADD CONSTRAINT userdataset_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userdatasetitem_userdataset_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userdatasetitem
    ADD CONSTRAINT userdatasetitem_userdataset_id FOREIGN KEY (userdataset_id) REFERENCES userdataset(userdataset_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: usernotify_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE usernotify
    ADD CONSTRAINT usernotify_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userpermission_embargo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userpermission
    ADD CONSTRAINT userpermission_embargo_id FOREIGN KEY (embargo_id) REFERENCES embargo(embargo_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userpermission_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userpermission
    ADD CONSTRAINT userpermission_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userpreference_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userpreference
    ADD CONSTRAINT userpreference_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userquery_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userquery
    ADD CONSTRAINT userquery_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userrecordowner_usr_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userrecordowner
    ADD CONSTRAINT userrecordowner_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: userregionalexp_usercertification_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE userregionalexp
    ADD CONSTRAINT userregionalexp_usercertification_id FOREIGN KEY (usercertification_id) REFERENCES usercertification(usercertification_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: usr_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--




--
-- Name: voucher_specimenreplicate_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE voucher
    ADD CONSTRAINT voucher_specimenreplicate_id FOREIGN KEY (specimenreplicate_id) REFERENCES specimenreplicate(specimenreplicate_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: voucher_taxonoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE voucher
    ADD CONSTRAINT voucher_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

