--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

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



SET search_path = public, pg_catalog;

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

CREATE TYPE occurrencestatus_dwc AS ENUM (
    'present',
    'absent',
    'common',
    'irregular',
    'rare',
    'doubtful'
);


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

CREATE FUNCTION aggregateoccurrence_plantobs_count_1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF new.plantobservation_id IS NOT NULL THEN
        new.count = 1;
    END IF;
    RETURN new;
END;
$$;


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

CREATE AGGREGATE concat(text) (
    SFUNC = textcat,
    STYPE = text,
    INITCOND = ''
);


SET default_tablespace = '';

SET default_with_oids = true;

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

CREATE TABLE address (
    address_id integer NOT NULL,
    party_id integer NOT NULL,
    organization_id integer,
    orgposition text,
    email text,
    deliverypoint text,
    city text,
    administrativearea text,
    postalcode text,
    country text,
    currentflag boolean,
    addressstartdate timestamp with time zone
);


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

CREATE SEQUENCE address_address_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE address_address_id_seq OWNED BY address.address_id;


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

CREATE TABLE aggregateoccurrence (
    aggregateoccurrence_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    cover double precision,
    basalarea double precision,
    biomass double precision,
    inferencearea double precision,
    stratumbase double precision,
    stratumheight double precision,
    emb_aggregateoccurrence integer,
    covercode text,
    count integer,
    accessioncode text,
    sourceaccessioncode text,
    plantobservation_id integer,
    stratum_id integer,
    sizeclass_id integer,
    coverindex_id integer,
    occurrencestatus_dwc occurrencestatus_dwc DEFAULT 'present'::occurrencestatus_dwc NOT NULL,
    CONSTRAINT aggregateoccurrence_plantobs_count_1 CHECK (((plantobservation_id IS NULL) OR (NOT (count IS DISTINCT FROM 1))))
);


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

COMMENT ON TABLE aggregateoccurrence IS 'VegBank''s taxonimportance table.';


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

COMMENT ON COLUMN aggregateoccurrence.occurrencestatus_dwc IS 'The extent to which the taxon is present. See <http://code.google.com/p/darwincore/wiki/Occurrence#occurrenceStatus>.';


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

CREATE SEQUENCE aggregateoccurrence_aggregateoccurrence_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE aggregateoccurrence_aggregateoccurrence_id_seq OWNED BY aggregateoccurrence.aggregateoccurrence_id;


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

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


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

CREATE SEQUENCE classcontributor_classcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE classcontributor_classcontributor_id_seq OWNED BY classcontributor.classcontributor_id;


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

CREATE TABLE commclass (
    commclass_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    inspection boolean,
    tableanalysis boolean,
    multivariateanalysis boolean,
    classpublication_id integer,
    classnotes text,
    commname text,
    commcode text,
    commframework text,
    commlevel text,
    classstartdate timestamp with time zone,
    classstopdate timestamp with time zone,
    emb_commclass integer,
    expertsystem text,
    accessioncode text
);


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

CREATE SEQUENCE commclass_commclass_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commclass_commclass_id_seq OWNED BY commclass.commclass_id;


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

CREATE TABLE commconcept (
    commconcept_id integer NOT NULL,
    commname_id integer NOT NULL,
    reference_id integer,
    commdescription text,
    d_obscount integer,
    commname text,
    d_currentaccepted boolean,
    accessioncode text
);


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

CREATE SEQUENCE commconcept_commconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commconcept_commconcept_id_seq OWNED BY commconcept.commconcept_id;


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

CREATE TABLE commcorrelation (
    commcorrelation_id integer NOT NULL,
    commstatus_id integer NOT NULL,
    commconcept_id integer NOT NULL,
    commconvergence text NOT NULL,
    correlationstart timestamp with time zone NOT NULL,
    correlationstop timestamp with time zone
);


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

CREATE SEQUENCE commcorrelation_commcorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commcorrelation_commcorrelation_id_seq OWNED BY commcorrelation.commcorrelation_id;


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

CREATE TABLE commdetermination (
    commdetermination_id integer NOT NULL,
    commclass_id integer NOT NULL,
    commconcept_id integer,
    commcode text,
    commname text,
    classfit text,
    classconfidence text,
    commauthority_id integer,
    notes text,
    type boolean,
    nomenclaturaltype boolean,
    emb_commdetermination integer
);


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

CREATE SEQUENCE commdetermination_commdetermination_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commdetermination_commdetermination_id_seq OWNED BY commdetermination.commdetermination_id;


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

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


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

CREATE SEQUENCE commlineage_commlineage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commlineage_commlineage_id_seq OWNED BY commlineage.commlineage_id;


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

CREATE TABLE commname (
    commname_id integer NOT NULL,
    commname text NOT NULL,
    reference_id integer,
    dateentered timestamp with time zone DEFAULT now()
);


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

CREATE SEQUENCE commname_commname_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commname_commname_id_seq OWNED BY commname.commname_id;


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

CREATE TABLE commstatus (
    commstatus_id integer NOT NULL,
    commconcept_id integer NOT NULL,
    reference_id integer,
    commconceptstatus text NOT NULL,
    commparent_id integer,
    commlevel text,
    commpartycomments text,
    party_id integer NOT NULL,
    startdate timestamp with time zone NOT NULL,
    stopdate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE commstatus_commstatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commstatus_commstatus_id_seq OWNED BY commstatus.commstatus_id;


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

CREATE TABLE commusage (
    commusage_id integer NOT NULL,
    commname_id integer NOT NULL,
    commname text,
    commconcept_id integer,
    commnamestatus text,
    classsystem text,
    party_id integer,
    commstatus_id integer,
    usagestart timestamp with time zone,
    usagestop timestamp with time zone
);


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

CREATE SEQUENCE commusage_commusage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE commusage_commusage_id_seq OWNED BY commusage.commusage_id;


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

CREATE TABLE coverindex (
    coverindex_id integer NOT NULL,
    covermethod_id integer NOT NULL,
    covercode text 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: -
--

CREATE SEQUENCE coverindex_coverindex_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE coverindex_coverindex_id_seq OWNED BY coverindex.coverindex_id;


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

CREATE TABLE covermethod (
    covermethod_id integer NOT NULL,
    reference_id integer,
    covertype text NOT NULL,
    coverestimationmethod text,
    accessioncode text
);


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

CREATE SEQUENCE covermethod_covermethod_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE covermethod_covermethod_id_seq OWNED BY covermethod.covermethod_id;


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

CREATE TABLE dba_confidentialitystatus (
    confidentialitystatus integer NOT NULL,
    confidentialitytext text,
    confidentialityshorttext text
);


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

CREATE TABLE dba_cookie (
    cookie_id integer NOT NULL,
    cookiename text NOT NULL,
    defaultvalue text NOT NULL,
    viewname text NOT NULL,
    description text,
    examplepk integer NOT NULL,
    sortorder integer,
    startgroup boolean,
    prefixhtml text,
    suffixhtml text
);


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

CREATE SEQUENCE dba_cookie_cookie_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_cookie_cookie_id_seq OWNED BY dba_cookie.cookie_id;


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

CREATE TABLE dba_cookielabels (
    cookielabel_id integer NOT NULL,
    vieworcookie text NOT NULL,
    description text
);


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

CREATE SEQUENCE dba_cookielabels_cookielabel_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_cookielabels_cookielabel_id_seq OWNED BY dba_cookielabels.cookielabel_id;


SET default_with_oids = false;

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

CREATE TABLE dba_datacache (
    dba_datacache_id integer NOT NULL,
    cache_key text NOT NULL,
    cache_label text,
    cache_order double precision,
    data1 text,
    data2 text,
    data3 text,
    data4 text,
    data5 text,
    data6 text,
    data7 text,
    data8 text,
    data9 text,
    data10 text
);


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

CREATE SEQUENCE dba_datacache_dba_datacache_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_datacache_dba_datacache_id_seq OWNED BY dba_datacache.dba_datacache_id;


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

CREATE TABLE dba_datamodelversion (
    dba_datamodelversion_id integer NOT NULL,
    versiontext text NOT NULL,
    versionimplemented timestamp with time zone DEFAULT now()
);


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

CREATE SEQUENCE dba_datamodelversion_dba_datamodelversion_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_datamodelversion_dba_datamodelversion_id_seq OWNED BY dba_datamodelversion.dba_datamodelversion_id;


SET default_with_oids = true;

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

CREATE TABLE dba_dbstatstime (
    stat_id integer NOT NULL,
    statdate timestamp with time zone,
    statpkg integer,
    statname text,
    stattable text,
    minpk integer,
    maxpk integer,
    countrecs integer
);


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

CREATE SEQUENCE dba_dbstatstime_stat_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_dbstatstime_stat_id_seq OWNED BY dba_dbstatstime.stat_id;


SET default_with_oids = false;

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

CREATE TABLE dba_fielddescription (
    dba_fielddescription_id integer NOT NULL,
    tablename text,
    fieldname text,
    fieldlabel text,
    fieldmodel text,
    fieldnulls text,
    fieldtype text,
    fieldkey text,
    fieldreferences text,
    fieldlist text,
    fieldnotes text,
    fielddefinition text,
    fieldkeywords text
);


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

CREATE SEQUENCE dba_fielddescription_dba_fielddescription_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_fielddescription_dba_fielddescription_id_seq OWNED BY dba_fielddescription.dba_fielddescription_id;


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

CREATE TABLE dba_fieldlist (
    dba_fieldlist_id integer NOT NULL,
    tablename text,
    fieldname text,
    listvalue text,
    listvaluedescription text,
    listvaluesortorder double precision
);


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

CREATE SEQUENCE dba_fieldlist_dba_fieldlist_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_fieldlist_dba_fieldlist_id_seq OWNED BY dba_fieldlist.dba_fieldlist_id;


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

CREATE TABLE dba_onerow (
    dba_onerow_id integer NOT NULL
);


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

CREATE SEQUENCE dba_onerow_dba_onerow_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_onerow_dba_onerow_id_seq OWNED BY dba_onerow.dba_onerow_id;


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

CREATE TABLE dba_preassignacccode (
    dba_preassignacccode_id integer NOT NULL,
    dba_requestnumber integer NOT NULL,
    databasekey text NOT NULL,
    tableabbrev text NOT NULL,
    confirmcode text DEFAULT ((replace(replace(replace(replace((now())::text, ' '::text, 'T'::text), '-'::text, ''::text), ':'::text, ''::text), '.'::text, 'd'::text) || 'R'::text) || (floor((random() * (1000000)::double precision)))::text) NOT NULL,
    codeisused boolean,
    accessioncode text
);


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

CREATE SEQUENCE dba_preassignacccode_dba_preassignacccode_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_preassignacccode_dba_preassignacccode_id_seq OWNED BY dba_preassignacccode.dba_preassignacccode_id;


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

CREATE SEQUENCE dba_preassignacccode_dba_requestnumber_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

CREATE TABLE dba_tabledescription (
    dba_tabledescription_id integer NOT NULL,
    tablename text,
    tablelabel text,
    tablenotes text,
    tabledescription text,
    tablekeywords text
);


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

CREATE SEQUENCE dba_tabledescription_dba_tabledescription_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_tabledescription_dba_tabledescription_id_seq OWNED BY dba_tabledescription.dba_tabledescription_id;


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

CREATE TABLE dba_xmlcache (
    xml bytea,
    accessioncode text
);


SET default_with_oids = true;

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

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


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

CREATE SEQUENCE definedvalue_definedvalue_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE definedvalue_definedvalue_id_seq OWNED BY definedvalue.definedvalue_id;


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

CREATE TABLE disturbanceobs (
    disturbanceobs_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    disturbancetype text NOT NULL,
    disturbanceintensity text,
    disturbanceage double precision,
    disturbanceextent double precision,
    disturbancecomment text,
    emb_disturbanceobs integer
);


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

CREATE SEQUENCE disturbanceobs_disturbanceobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE disturbanceobs_disturbanceobs_id_seq OWNED BY disturbanceobs.disturbanceobs_id;


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

CREATE TABLE embargo (
    embargo_id integer NOT NULL,
    location_id integer NOT NULL,
    embargoreason text NOT NULL,
    defaultstatus integer NOT NULL,
    embargostart timestamp with time zone NOT NULL,
    embargostop timestamp with time zone NOT NULL
);


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

CREATE SEQUENCE embargo_embargo_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE embargo_embargo_id_seq OWNED BY embargo.embargo_id;


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

CREATE TABLE graphic (
    graphic_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    graphicname text,
    graphiclocation text,
    graphicdescription text,
    graphictype text,
    graphicdata oid,
    graphicdate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE graphic_graphic_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE graphic_graphic_id_seq OWNED BY graphic.graphic_id;


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

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


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

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


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

CREATE TABLE location (
    location_id integer NOT NULL,
    authorlocationcode text,
    reference_id integer,
    parent_id integer,
    reallatitude double precision,
    reallongitude double precision,
    locationaccuracy double precision,
    confidentialitystatus integer DEFAULT 0 NOT NULL,
    confidentialityreason text,
    publiclatitude double precision,
    publiclongitude double precision,
    accessioncode text,
    sublocationxposition double precision,
    sublocationyposition double precision,
    authore text,
    authorn text,
    authorzone text,
    authordatum text,
    authorlocation text,
    locationnarrative text,
    azimuth double precision,
    dsgpoly text,
    shape text,
    area double precision,
    standsize text,
    placementmethod text,
    permanence boolean,
    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 text,
    landform text,
    surficialdeposits text,
    rocktype text,
    stateprovince text,
    country text,
    submitter_surname text,
    submitter_givenname text,
    submitter_email text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    dateentered timestamp with time zone DEFAULT now(),
    emb_location integer,
    locationrationalenarrative text
);


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

CREATE SEQUENCE location_location_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE location_location_id_seq OWNED BY location.location_id;


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

CREATE TABLE locationevent (
    locationevent_id integer NOT NULL,
    previous_id integer,
    location_id integer,
    project_id integer,
    authoreventcode text,
    accessioncode text,
    sourceaccessioncode text,
    dateaccuracy text,
    covermethod_id integer,
    coverdispersion text,
    autotaxoncover boolean,
    plotmethod_id integer,
    methodnarrative text,
    taxonoccurrencearea double precision,
    stemsizelimit double precision,
    stemarea double precision,
    stemsamplemethod text,
    originaldata text,
    effortlevel text,
    locationvalidationlevel integer,
    floristicquality text,
    bryophytequality text,
    lichenquality text,
    locationeventnarrative text,
    landscapenarrative text,
    homogeneity text,
    phenologicaspect text,
    representativeness text,
    standmaturity text,
    successionalstatus text,
    basalarea double precision,
    hydrologicregime text,
    soilmoistureregime text,
    soildrainage text,
    watersalinity text,
    waterdepth double precision,
    shoredistance double precision,
    soildepth double precision,
    organicdepth double precision,
    soiltaxon_id integer,
    soiltaxonsrc text,
    percentbedrock double precision,
    percentrockgravel double precision,
    percentwood double precision,
    percentlitter double precision,
    percentbaresoil double precision,
    percentwater double precision,
    percentother double precision,
    nameother text,
    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 text,
    growthform1type text,
    growthform2type text,
    growthform3type text,
    growthform1cover double precision,
    growthform2cover double precision,
    growthform3cover double precision,
    totalcover double precision,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    obsstartdate timestamp with time zone,
    obsenddate timestamp with time zone,
    dateentered timestamp with time zone DEFAULT now(),
    emb_locationevent integer,
    interp_orig_ci_id integer,
    interp_orig_cc_id integer,
    interp_orig_sciname text,
    interp_orig_code text,
    interp_orig_party_id integer,
    interp_orig_partyname text,
    interp_current_ci_id integer,
    interp_current_cc_id integer,
    interp_current_sciname text,
    interp_current_code text,
    interp_current_party_id integer,
    interp_current_partyname text,
    interp_bestfit_ci_id integer,
    interp_bestfit_cc_id integer,
    interp_bestfit_sciname text,
    interp_bestfit_code text,
    interp_bestfit_party_id integer,
    interp_bestfit_partyname text,
    toptaxon1name text,
    toptaxon2name text,
    toptaxon3name text,
    toptaxon4name text,
    toptaxon5name text,
    numberoftaxa integer
);


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

COMMENT ON TABLE locationevent IS 'VegBank''s observation table.';


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

CREATE SEQUENCE locationevent_locationevent_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE locationevent_locationevent_id_seq OWNED BY locationevent.locationevent_id;


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

CREATE TABLE locationeventcontributor (
    locationeventcontributor_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    contributiondate timestamp with time zone
);


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

CREATE SEQUENCE locationeventcontributor_locationeventcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE locationeventcontributor_locationeventcontributor_id_seq OWNED BY locationeventcontributor.locationeventcontributor_id;


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

CREATE TABLE locationeventsynonym (
    locationeventsynonym_id integer NOT NULL,
    synonymlocationevent_id integer NOT NULL,
    primarylocationevent_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    synonymcomment text,
    classstartdate timestamp with time zone DEFAULT now() NOT NULL,
    classstopdate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE locationeventsynonym_locationeventsynonym_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE locationeventsynonym_locationeventsynonym_id_seq OWNED BY locationeventsynonym.locationeventsynonym_id;


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

CREATE TABLE locationplace (
    locationplace_id integer NOT NULL,
    location_id integer NOT NULL,
    calculated boolean,
    namedplace_id integer NOT NULL
);


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

CREATE SEQUENCE locationplace_locationplace_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE locationplace_locationplace_id_seq OWNED BY locationplace.locationplace_id;


SET default_with_oids = false;

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

CREATE TABLE morphospecies (
    morphospecies_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    name text NOT NULL
);


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

CREATE SEQUENCE morphospecies_morphospecies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE morphospecies_morphospecies_id_seq OWNED BY morphospecies.morphospecies_id;


SET default_with_oids = true;

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

CREATE TABLE namedplace (
    namedplace_id integer NOT NULL,
    placesystem text,
    placename text NOT NULL,
    placedescription text,
    placecode text,
    owner text,
    reference_id integer,
    d_obscount integer,
    accessioncode text
);


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

CREATE SEQUENCE namedplace_namedplace_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE namedplace_namedplace_id_seq OWNED BY namedplace.namedplace_id;


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

CREATE TABLE namedplacecorrelation (
    namedplacecorrelation_id integer NOT NULL,
    parentplace_id integer NOT NULL,
    childplace_id integer NOT NULL,
    placeconvergence text NOT NULL
);


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

CREATE SEQUENCE namedplacecorrelation_namedplacecorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE namedplacecorrelation_namedplacecorrelation_id_seq OWNED BY namedplacecorrelation.namedplacecorrelation_id;


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

CREATE TABLE note (
    note_id integer NOT NULL,
    notelink_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    notetype text NOT NULL,
    notetext text NOT NULL,
    notedate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE note_note_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE note_note_id_seq OWNED BY note.note_id;


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

CREATE TABLE notelink (
    notelink_id integer NOT NULL,
    tablename text NOT NULL,
    attributename text,
    tablerecord integer NOT NULL
);


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

CREATE SEQUENCE notelink_notelink_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE notelink_notelink_id_seq OWNED BY notelink.notelink_id;


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

CREATE TABLE party (
    party_id integer NOT NULL,
    salutation text,
    givenname text,
    middlename text,
    surname text,
    organizationname text,
    currentname_id integer,
    contactinstructions text,
    email text,
    partytype text,
    partypublic boolean DEFAULT true,
    d_obscount integer,
    accessioncode text
);


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

CREATE SEQUENCE party_party_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE party_party_id_seq OWNED BY party.party_id;


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

CREATE TABLE partymember (
    partymember_id integer NOT NULL,
    parentparty_id integer NOT NULL,
    childparty_id integer NOT NULL,
    role_id integer,
    memberstart timestamp with time zone DEFAULT now() NOT NULL,
    memberstop timestamp with time zone
);


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

CREATE SEQUENCE partymember_partymember_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE partymember_partymember_id_seq OWNED BY partymember.partymember_id;


SET default_with_oids = false;

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

CREATE TABLE plant (
    plant_id integer NOT NULL
);


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

COMMENT ON TABLE plant IS 'A physical, tagged plant.';


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

CREATE SEQUENCE plant_plant_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plant_plant_id_seq OWNED BY plant.plant_id;


SET default_with_oids = true;

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

CREATE TABLE plantconcept (
    plantconcept_id integer NOT NULL,
    plantname_id integer NOT NULL,
    reference_id integer,
    plantcode text,
    plantdescription text,
    d_obscount integer,
    d_currentaccepted boolean,
    accessioncode text
);


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

CREATE SEQUENCE plantconcept_plantconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantconcept_plantconcept_id_seq OWNED BY plantconcept.plantconcept_id;


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

CREATE TABLE plantcorrelation (
    plantcorrelation_id integer NOT NULL,
    plantstatus_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    plantconvergence text NOT NULL,
    correlationstart timestamp with time zone NOT NULL,
    correlationstop timestamp with time zone
);


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

CREATE SEQUENCE plantcorrelation_plantcorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantcorrelation_plantcorrelation_id_seq OWNED BY plantcorrelation.plantcorrelation_id;


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

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


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

CREATE SEQUENCE plantlineage_plantlineage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantlineage_plantlineage_id_seq OWNED BY plantlineage.plantlineage_id;


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

CREATE TABLE plantname (
    plantname_id integer NOT NULL,
    plantname text NOT NULL,
    reference_id integer,
    dateentered timestamp with time zone DEFAULT now()
);


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

CREATE SEQUENCE plantname_plantname_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantname_plantname_id_seq OWNED BY plantname.plantname_id;


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

CREATE TABLE plantobservation (
    plantobservation_id integer NOT NULL,
    overallheight double precision,
    overallheightaccuracy double precision,
    emb_plantobservation integer,
    authorplantcode text,
    accessioncode text,
    stemcount integer,
    sourceaccessioncode text,
    plant_id integer
);


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

COMMENT ON TABLE plantobservation IS 'VegBank''s stemcount table.';


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

CREATE SEQUENCE plantobservation_plantobservation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantobservation_plantobservation_id_seq OWNED BY plantobservation.plantobservation_id;


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

CREATE TABLE plantstatus (
    plantstatus_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    reference_id integer,
    plantconceptstatus text DEFAULT 'undetermined'::text NOT NULL,
    plantpartycomments text,
    plantparentname text,
    plantparentconcept_id integer,
    plantparent_id integer,
    plantlevel text,
    party_id integer,
    startdate timestamp with time zone,
    stopdate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE plantstatus_plantstatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantstatus_plantstatus_id_seq OWNED BY plantstatus.plantstatus_id;


SET default_with_oids = false;

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

CREATE TABLE planttag (
    planttag_id integer NOT NULL,
    plantobservation_id integer NOT NULL,
    tag text NOT NULL,
    iscurrent boolean DEFAULT true NOT NULL
);


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

CREATE SEQUENCE planttag_planttag_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE planttag_planttag_id_seq OWNED BY planttag.planttag_id;


SET default_with_oids = true;

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

CREATE TABLE plantusage (
    plantusage_id integer NOT NULL,
    plantname_id integer NOT NULL,
    plantconcept_id integer,
    plantnamestatus text,
    plantname text,
    classsystem text,
    acceptedsynonym text,
    party_id integer,
    plantstatus_id integer,
    usagestart timestamp with time zone,
    usagestop timestamp with time zone
);


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

CREATE SEQUENCE plantusage_plantusage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plantusage_plantusage_id_seq OWNED BY plantusage.plantusage_id;


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

CREATE TABLE plotmethod (
    plotmethod_id integer NOT NULL,
    reference_id integer,
    name text NOT NULL,
    description text,
    accessioncode text
);


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

CREATE SEQUENCE plotmethod_plotmethod_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE plotmethod_plotmethod_id_seq OWNED BY plotmethod.plotmethod_id;


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

CREATE TABLE project (
    project_id integer NOT NULL,
    projectname text NOT NULL,
    projectdescription text,
    startdate timestamp with time zone,
    stopdate timestamp with time zone,
    d_obscount integer,
    d_lastlocationaddeddate timestamp with time zone,
    accessioncode text,
    reference_id integer
);


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

CREATE SEQUENCE project_project_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE project_project_id_seq OWNED BY project.project_id;


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

CREATE TABLE projectcontributor (
    projectcontributor_id integer NOT NULL,
    project_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer,
    surname text,
    cheatrole text
);


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

CREATE SEQUENCE projectcontributor_projectcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE projectcontributor_projectcontributor_id_seq OWNED BY projectcontributor.projectcontributor_id;


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

CREATE TABLE reference (
    reference_id integer NOT NULL,
    shortname text,
    fulltext text,
    referencetype text,
    title text,
    titlesuperior text,
    referencejournal_id integer,
    volume text,
    issue text,
    pagerange text,
    totalpages integer,
    publisher text,
    publicationplace text,
    isbn text,
    edition text,
    numberofvolumes integer,
    chapternumber integer,
    reportnumber integer,
    communicationtype text,
    degree text,
    url text,
    doi text,
    additionalinfo text,
    pubdate timestamp with time zone,
    accessdate timestamp with time zone,
    conferencedate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE reference_reference_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE reference_reference_id_seq OWNED BY reference.reference_id;


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

CREATE TABLE referencealtident (
    referencealtident_id integer NOT NULL,
    reference_id integer NOT NULL,
    system text,
    identifier text NOT NULL
);


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

CREATE SEQUENCE referencealtident_referencealtident_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE referencealtident_referencealtident_id_seq OWNED BY referencealtident.referencealtident_id;


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

CREATE TABLE referencecontributor (
    referencecontributor_id integer NOT NULL,
    reference_id integer NOT NULL,
    referenceparty_id integer NOT NULL,
    roletype text,
    "position" integer
);


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

CREATE SEQUENCE referencecontributor_referencecontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE referencecontributor_referencecontributor_id_seq OWNED BY referencecontributor.referencecontributor_id;


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

CREATE TABLE referencejournal (
    referencejournal_id integer NOT NULL,
    journal text NOT NULL,
    issn text,
    abbreviation text,
    accessioncode text
);


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

CREATE SEQUENCE referencejournal_referencejournal_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE referencejournal_referencejournal_id_seq OWNED BY referencejournal.referencejournal_id;


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

CREATE TABLE referenceparty (
    referenceparty_id integer NOT NULL,
    type text,
    positionname text,
    salutation text,
    givenname text,
    surname text,
    suffix text,
    organizationname text,
    currentparty_id integer,
    accessioncode text
);


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

CREATE SEQUENCE referenceparty_referenceparty_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE referenceparty_referenceparty_id_seq OWNED BY referenceparty.referenceparty_id;


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

CREATE TABLE revision (
    revision_id integer NOT NULL,
    tablename text NOT NULL,
    tableattribute text NOT NULL,
    tablerecord integer NOT NULL,
    previousvaluetext text NOT NULL,
    previousvaluetype text NOT NULL,
    previousrevision_id integer,
    revisiondate timestamp with time zone NOT NULL
);


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

CREATE SEQUENCE revision_revision_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE revision_revision_id_seq OWNED BY revision.revision_id;


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

CREATE TABLE role (
    role_id integer NOT NULL,
    rolecode text NOT NULL,
    roledescription text,
    roleproject integer,
    roleobservation integer,
    roletaxonint integer,
    roleclassint integer,
    accessioncode text
);


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

CREATE SEQUENCE role_role_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE role_role_id_seq OWNED BY role.role_id;


SET default_with_oids = false;

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

CREATE TABLE sizeclass (
    sizeclass_id integer NOT NULL,
    mindiameter double precision,
    minheight double precision,
    maxdiameter double precision,
    maxheight double precision,
    accessioncode text
);


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

COMMENT ON TABLE sizeclass IS 'A range of size measurements used to aggregate organisms.';


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

CREATE SEQUENCE sizeclass_sizeclass_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE sizeclass_sizeclass_id_seq OWNED BY sizeclass.sizeclass_id;


SET default_with_oids = true;

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

CREATE TABLE soilobs (
    soilobs_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    soilhorizon text NOT NULL,
    soildepthtop double precision,
    soildepthbottom double precision,
    soilcolor text,
    soilorganic double precision,
    soiltexture text,
    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 integer
);


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

CREATE SEQUENCE soilobs_soilobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE soilobs_soilobs_id_seq OWNED BY soilobs.soilobs_id;


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

CREATE TABLE soiltaxon (
    soiltaxon_id integer NOT NULL,
    soilcode text,
    soilname text,
    soillevel integer,
    soilparent_id integer,
    soilframework text,
    accessioncode text
);


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

CREATE SEQUENCE soiltaxon_soiltaxon_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE soiltaxon_soiltaxon_id_seq OWNED BY soiltaxon.soiltaxon_id;


SET default_with_oids = false;

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

CREATE TABLE specimen (
    specimen_id integer NOT NULL
);


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

COMMENT ON TABLE specimen IS 'A physical specimen collected from a plant. Used to link replicates of the same specimen together.';


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

CREATE SEQUENCE specimen_specimen_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE specimen_specimen_id_seq OWNED BY specimen.specimen_id;


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

CREATE TABLE specimenreplicate (
    specimenreplicate_id integer NOT NULL,
    reference_id integer NOT NULL,
    collectioncode_dwc text,
    catalognumber_dwc text,
    collectiondate timestamp with time zone,
    museum_id integer,
    sourceaccessioncode text,
    accessioncode text,
    taxonoccurrence_id integer NOT NULL,
    verbatimcollectorname text,
    collectionnumber text,
    specimen_id integer
);


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

COMMENT ON TABLE specimenreplicate IS 'A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.';


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

COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.';


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

COMMENT ON COLUMN specimenreplicate.collectionnumber IS 'The number of the specimenreplicate within the collection.';


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

CREATE SEQUENCE specimenreplicate_specimenreplicate_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE specimenreplicate_specimenreplicate_id_seq OWNED BY specimenreplicate.specimenreplicate_id;


SET default_with_oids = true;

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

CREATE TABLE stemobservation (
    stemobservation_id integer NOT NULL,
    plantobservation_id integer NOT NULL,
    authorstemcode text,
    xposition double precision,
    yposition double precision,
    health text,
    emb_stemobservation integer,
    diameter double precision,
    height double precision,
    heightaccuracy double precision,
    age double precision,
    accessioncode text,
    diameteraccuracy double precision,
    sourceaccessioncode text
);


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

COMMENT ON TABLE stemobservation IS 'VegBank''s stemlocation table.';


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

CREATE SEQUENCE stemobservation_stemobservation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE stemobservation_stemobservation_id_seq OWNED BY stemobservation.stemobservation_id;


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

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


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

CREATE SEQUENCE stratum_stratum_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE stratum_stratum_id_seq OWNED BY stratum.stratum_id;


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

CREATE TABLE stratummethod (
    stratummethod_id integer NOT NULL,
    reference_id integer,
    stratummethodname text NOT NULL,
    stratummethoddescription text,
    stratumassignment text,
    accessioncode text
);


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

CREATE SEQUENCE stratummethod_stratummethod_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE stratummethod_stratummethod_id_seq OWNED BY stratummethod.stratummethod_id;


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

CREATE TABLE stratumtype (
    stratumtype_id integer NOT NULL,
    stratummethod_id integer NOT NULL,
    stratumindex text,
    stratumname text,
    stratumdescription text
);


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

CREATE SEQUENCE stratumtype_stratumtype_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE stratumtype_stratumtype_id_seq OWNED BY stratumtype.stratumtype_id;


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

CREATE TABLE taxonalt (
    taxonalt_id integer NOT NULL,
    taxondetermination_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    taxonaltfit text,
    taxonaltconfidence text,
    taxonaltnotes text,
    emb_taxonalt integer
);


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

CREATE SEQUENCE taxonalt_taxonalt_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE taxonalt_taxonalt_id_seq OWNED BY taxonalt.taxonalt_id;


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

CREATE TABLE taxondetermination (
    taxondetermination_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    party_id integer,
    role_id integer NOT NULL,
    determinationtype text,
    reference_id integer,
    isoriginal boolean DEFAULT false NOT NULL,
    iscurrent boolean DEFAULT false NOT NULL,
    taxonfit text,
    taxonconfidence text,
    grouptype text,
    notes text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    determinationdate timestamp with time zone,
    emb_taxondetermination integer,
    accessioncode text,
    morphospecies_id integer
);


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

COMMENT ON TABLE taxondetermination IS 'VegBank''s taxoninterpretation table.';


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

CREATE SEQUENCE taxondetermination_taxondetermination_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE taxondetermination_taxondetermination_id_seq OWNED BY taxondetermination.taxondetermination_id;


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

CREATE TABLE taxonoccurrence (
    taxonoccurrence_id integer NOT NULL,
    locationevent_id integer,
    authorplantname text,
    reference_id integer,
    emb_taxonoccurrence integer,
    accessioncode text
);


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

COMMENT ON TABLE taxonoccurrence IS 'VegBank''s taxonobservation table.';


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

CREATE SEQUENCE taxonoccurrence_taxonoccurrence_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE taxonoccurrence_taxonoccurrence_id_seq OWNED BY taxonoccurrence.taxonoccurrence_id;


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

CREATE TABLE telephone (
    telephone_id integer NOT NULL,
    party_id integer NOT NULL,
    phonenumber text NOT NULL,
    phonetype text NOT NULL
);


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

CREATE SEQUENCE telephone_telephone_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE telephone_telephone_id_seq OWNED BY telephone.telephone_id;


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

CREATE TABLE temptbl_std_commnames (
    commconcept_id integer NOT NULL,
    sciname text,
    translated text,
    code text,
    common text
);


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

CREATE SEQUENCE temptbl_std_commnames_commconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE temptbl_std_commnames_commconcept_id_seq OWNED BY temptbl_std_commnames.commconcept_id;


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

CREATE TABLE temptbl_std_plantnames (
    plantconcept_id integer NOT NULL,
    plantname text,
    sciname text,
    scinamenoauth text,
    code text,
    common text
);


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

CREATE SEQUENCE temptbl_std_plantnames_plantconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE temptbl_std_plantnames_plantconcept_id_seq OWNED BY temptbl_std_plantnames.plantconcept_id;


SET default_with_oids = false;

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

CREATE TABLE trait (
    trait_id integer NOT NULL,
    stemobservation_id integer NOT NULL,
    type text NOT NULL,
    value text
);


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

CREATE SEQUENCE trait_trait_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE trait_trait_id_seq OWNED BY trait.trait_id;


SET default_with_oids = true;

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

CREATE TABLE usercertification (
    usercertification_id integer NOT NULL,
    usr_id integer NOT NULL,
    current_cert_level integer NOT NULL,
    requested_cert_level integer NOT NULL,
    highest_degree text,
    degree_year text,
    degree_institution text,
    current_org text,
    current_pos text,
    esa_member boolean,
    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 text,
    esa_sponsor_email_a text,
    esa_sponsor_name_b text,
    esa_sponsor_email_b text,
    peer_review boolean,
    addl_stmt text,
    certificationstatus text,
    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: -
--

CREATE SEQUENCE usercertification_usercertification_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE usercertification_usercertification_id_seq OWNED BY usercertification.usercertification_id;


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

CREATE TABLE userdataset (
    userdataset_id integer NOT NULL,
    usr_id integer,
    datasetname text NOT NULL,
    datasetdescription text,
    datasettype text,
    datasetsharing text,
    datasetpassword text,
    datasetstop timestamp with time zone,
    datasetstart timestamp with time zone DEFAULT now(),
    accessioncode text
);


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

CREATE SEQUENCE userdataset_userdataset_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userdataset_userdataset_id_seq OWNED BY userdataset.userdataset_id;


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

CREATE TABLE userdatasetitem (
    userdatasetitem_id integer NOT NULL,
    userdataset_id integer NOT NULL,
    itemaccessioncode text NOT NULL,
    itemtype text,
    notes text,
    itemstart timestamp with time zone DEFAULT now() NOT NULL,
    itemstop timestamp with time zone,
    externalaccessioncode text,
    itemdatabase text NOT NULL,
    itemtable text NOT NULL,
    itemrecord integer NOT NULL
);


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

CREATE SEQUENCE userdatasetitem_userdatasetitem_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userdatasetitem_userdatasetitem_id_seq OWNED BY userdatasetitem.userdatasetitem_id;


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

CREATE TABLE userdefined (
    userdefined_id integer NOT NULL,
    userdefinedname text,
    userdefinedmetadata text,
    userdefinedcategory text,
    userdefinedtype text DEFAULT 'text'::text NOT NULL,
    tablename text NOT NULL,
    accessioncode text
);


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

CREATE SEQUENCE userdefined_userdefined_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userdefined_userdefined_id_seq OWNED BY userdefined.userdefined_id;


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

CREATE TABLE usernotify (
    usernotify_id integer NOT NULL,
    usr_id integer NOT NULL,
    notifyname text,
    notifydescription text,
    notifysql text,
    notifystart timestamp with time zone DEFAULT now(),
    notifystop timestamp with time zone,
    lastcheckdate timestamp with time zone
);


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

CREATE SEQUENCE usernotify_usernotify_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE usernotify_usernotify_id_seq OWNED BY usernotify.usernotify_id;


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

CREATE TABLE userpermission (
    userpermission_id integer NOT NULL,
    embargo_id integer NOT NULL,
    usr_id integer NOT NULL,
    permissionstatus integer NOT NULL,
    permissionnotes text,
    permissionstop timestamp with time zone,
    permissionstart timestamp with time zone DEFAULT now() NOT NULL
);


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

CREATE SEQUENCE userpermission_userpermission_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userpermission_userpermission_id_seq OWNED BY userpermission.userpermission_id;


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

CREATE TABLE userpreference (
    userpreference_id integer NOT NULL,
    usr_id integer NOT NULL,
    preferencename text,
    preferencevalue text,
    preferencepriority double precision,
    preferencestop timestamp with time zone,
    preferencestart timestamp with time zone DEFAULT now()
);


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

CREATE SEQUENCE userpreference_userpreference_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userpreference_userpreference_id_seq OWNED BY userpreference.userpreference_id;


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

CREATE TABLE userquery (
    userquery_id integer NOT NULL,
    usr_id integer NOT NULL,
    queryname text,
    querydescription text,
    querysql text,
    querytype text,
    querysharing text,
    querypassword text,
    querystop timestamp with time zone,
    querystart timestamp with time zone DEFAULT now(),
    accessioncode text
);


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

CREATE SEQUENCE userquery_userquery_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userquery_userquery_id_seq OWNED BY userquery.userquery_id;


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

CREATE TABLE userrecordowner (
    userrecordowner_id integer NOT NULL,
    usr_id integer NOT NULL,
    tablename text NOT NULL,
    tablerecord integer NOT NULL,
    ownertype text NOT NULL,
    recordcreationdate timestamp with time zone NOT NULL,
    ownerstop timestamp with time zone,
    ownerstart timestamp with time zone DEFAULT now() NOT NULL
);


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

CREATE SEQUENCE userrecordowner_userrecordowner_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userrecordowner_userrecordowner_id_seq OWNED BY userrecordowner.userrecordowner_id;


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

CREATE TABLE userregionalexp (
    userregionalexp_id integer NOT NULL,
    usercertification_id integer NOT NULL,
    region text NOT NULL,
    vegetation text,
    floristics text,
    nvc_ivc text
);


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

CREATE SEQUENCE userregionalexp_userregionalexp_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE userregionalexp_userregionalexp_id_seq OWNED BY userregionalexp.userregionalexp_id;


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

CREATE TABLE usr (
    usr_id integer NOT NULL,
    party_id integer NOT NULL,
    permission_type integer NOT NULL,
    ticket_count integer,
    email_address text NOT NULL,
    preferred_name text,
    remote_address text,
    last_connect timestamp with time zone,
    begin_time timestamp with time zone,
    password text
);


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

CREATE SEQUENCE usr_usr_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE usr_usr_id_seq OWNED BY usr.usr_id;


SET default_with_oids = false;

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

CREATE TABLE voucher (
    voucher_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    specimenreplicate_id integer NOT NULL,
    accessioncode text
);


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

CREATE SEQUENCE voucher_voucher_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


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

ALTER SEQUENCE voucher_voucher_id_seq OWNED BY voucher.voucher_id;


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

ALTER TABLE address ALTER COLUMN address_id SET DEFAULT nextval('address_address_id_seq'::regclass);


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

ALTER TABLE aggregateoccurrence ALTER COLUMN aggregateoccurrence_id SET DEFAULT nextval('aggregateoccurrence_aggregateoccurrence_id_seq'::regclass);


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

ALTER TABLE classcontributor ALTER COLUMN classcontributor_id SET DEFAULT nextval('classcontributor_classcontributor_id_seq'::regclass);


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

ALTER TABLE commclass ALTER COLUMN commclass_id SET DEFAULT nextval('commclass_commclass_id_seq'::regclass);


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

ALTER TABLE commconcept ALTER COLUMN commconcept_id SET DEFAULT nextval('commconcept_commconcept_id_seq'::regclass);


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

ALTER TABLE commcorrelation ALTER COLUMN commcorrelation_id SET DEFAULT nextval('commcorrelation_commcorrelation_id_seq'::regclass);


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

ALTER TABLE commdetermination ALTER COLUMN commdetermination_id SET DEFAULT nextval('commdetermination_commdetermination_id_seq'::regclass);


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

ALTER TABLE commlineage ALTER COLUMN commlineage_id SET DEFAULT nextval('commlineage_commlineage_id_seq'::regclass);


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

ALTER TABLE commname ALTER COLUMN commname_id SET DEFAULT nextval('commname_commname_id_seq'::regclass);


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

ALTER TABLE commstatus ALTER COLUMN commstatus_id SET DEFAULT nextval('commstatus_commstatus_id_seq'::regclass);


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

ALTER TABLE commusage ALTER COLUMN commusage_id SET DEFAULT nextval('commusage_commusage_id_seq'::regclass);


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

ALTER TABLE coverindex ALTER COLUMN coverindex_id SET DEFAULT nextval('coverindex_coverindex_id_seq'::regclass);


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

ALTER TABLE covermethod ALTER COLUMN covermethod_id SET DEFAULT nextval('covermethod_covermethod_id_seq'::regclass);


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

ALTER TABLE dba_cookie ALTER COLUMN cookie_id SET DEFAULT nextval('dba_cookie_cookie_id_seq'::regclass);


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

ALTER TABLE dba_cookielabels ALTER COLUMN cookielabel_id SET DEFAULT nextval('dba_cookielabels_cookielabel_id_seq'::regclass);


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

ALTER TABLE dba_datacache ALTER COLUMN dba_datacache_id SET DEFAULT nextval('dba_datacache_dba_datacache_id_seq'::regclass);


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

ALTER TABLE dba_datamodelversion ALTER COLUMN dba_datamodelversion_id SET DEFAULT nextval('dba_datamodelversion_dba_datamodelversion_id_seq'::regclass);


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

ALTER TABLE dba_dbstatstime ALTER COLUMN stat_id SET DEFAULT nextval('dba_dbstatstime_stat_id_seq'::regclass);


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

ALTER TABLE dba_fielddescription ALTER COLUMN dba_fielddescription_id SET DEFAULT nextval('dba_fielddescription_dba_fielddescription_id_seq'::regclass);


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

ALTER TABLE dba_fieldlist ALTER COLUMN dba_fieldlist_id SET DEFAULT nextval('dba_fieldlist_dba_fieldlist_id_seq'::regclass);


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

ALTER TABLE dba_onerow ALTER COLUMN dba_onerow_id SET DEFAULT nextval('dba_onerow_dba_onerow_id_seq'::regclass);


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

ALTER TABLE dba_preassignacccode ALTER COLUMN dba_preassignacccode_id SET DEFAULT nextval('dba_preassignacccode_dba_preassignacccode_id_seq'::regclass);


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

ALTER TABLE dba_tabledescription ALTER COLUMN dba_tabledescription_id SET DEFAULT nextval('dba_tabledescription_dba_tabledescription_id_seq'::regclass);


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

ALTER TABLE definedvalue ALTER COLUMN definedvalue_id SET DEFAULT nextval('definedvalue_definedvalue_id_seq'::regclass);


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

ALTER TABLE disturbanceobs ALTER COLUMN disturbanceobs_id SET DEFAULT nextval('disturbanceobs_disturbanceobs_id_seq'::regclass);


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

ALTER TABLE embargo ALTER COLUMN embargo_id SET DEFAULT nextval('embargo_embargo_id_seq'::regclass);


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

ALTER TABLE graphic ALTER COLUMN graphic_id SET DEFAULT nextval('graphic_graphic_id_seq'::regclass);


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

ALTER TABLE location ALTER COLUMN location_id SET DEFAULT nextval('location_location_id_seq'::regclass);


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

ALTER TABLE locationevent ALTER COLUMN locationevent_id SET DEFAULT nextval('locationevent_locationevent_id_seq'::regclass);


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

ALTER TABLE locationeventcontributor ALTER COLUMN locationeventcontributor_id SET DEFAULT nextval('locationeventcontributor_locationeventcontributor_id_seq'::regclass);


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

ALTER TABLE locationeventsynonym ALTER COLUMN locationeventsynonym_id SET DEFAULT nextval('locationeventsynonym_locationeventsynonym_id_seq'::regclass);


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

ALTER TABLE locationplace ALTER COLUMN locationplace_id SET DEFAULT nextval('locationplace_locationplace_id_seq'::regclass);


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

ALTER TABLE morphospecies ALTER COLUMN morphospecies_id SET DEFAULT nextval('morphospecies_morphospecies_id_seq'::regclass);


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

ALTER TABLE namedplace ALTER COLUMN namedplace_id SET DEFAULT nextval('namedplace_namedplace_id_seq'::regclass);


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

ALTER TABLE namedplacecorrelation ALTER COLUMN namedplacecorrelation_id SET DEFAULT nextval('namedplacecorrelation_namedplacecorrelation_id_seq'::regclass);


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

ALTER TABLE note ALTER COLUMN note_id SET DEFAULT nextval('note_note_id_seq'::regclass);


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

ALTER TABLE notelink ALTER COLUMN notelink_id SET DEFAULT nextval('notelink_notelink_id_seq'::regclass);


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

ALTER TABLE party ALTER COLUMN party_id SET DEFAULT nextval('party_party_id_seq'::regclass);


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

ALTER TABLE partymember ALTER COLUMN partymember_id SET DEFAULT nextval('partymember_partymember_id_seq'::regclass);


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

ALTER TABLE plant ALTER COLUMN plant_id SET DEFAULT nextval('plant_plant_id_seq'::regclass);


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

ALTER TABLE plantconcept ALTER COLUMN plantconcept_id SET DEFAULT nextval('plantconcept_plantconcept_id_seq'::regclass);


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

ALTER TABLE plantcorrelation ALTER COLUMN plantcorrelation_id SET DEFAULT nextval('plantcorrelation_plantcorrelation_id_seq'::regclass);


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

ALTER TABLE plantlineage ALTER COLUMN plantlineage_id SET DEFAULT nextval('plantlineage_plantlineage_id_seq'::regclass);


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

ALTER TABLE plantname ALTER COLUMN plantname_id SET DEFAULT nextval('plantname_plantname_id_seq'::regclass);


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

ALTER TABLE plantobservation ALTER COLUMN plantobservation_id SET DEFAULT nextval('plantobservation_plantobservation_id_seq'::regclass);


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

ALTER TABLE plantstatus ALTER COLUMN plantstatus_id SET DEFAULT nextval('plantstatus_plantstatus_id_seq'::regclass);


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

ALTER TABLE planttag ALTER COLUMN planttag_id SET DEFAULT nextval('planttag_planttag_id_seq'::regclass);


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

ALTER TABLE plantusage ALTER COLUMN plantusage_id SET DEFAULT nextval('plantusage_plantusage_id_seq'::regclass);


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

ALTER TABLE plotmethod ALTER COLUMN plotmethod_id SET DEFAULT nextval('plotmethod_plotmethod_id_seq'::regclass);


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

ALTER TABLE project ALTER COLUMN project_id SET DEFAULT nextval('project_project_id_seq'::regclass);


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

ALTER TABLE projectcontributor ALTER COLUMN projectcontributor_id SET DEFAULT nextval('projectcontributor_projectcontributor_id_seq'::regclass);


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

ALTER TABLE reference ALTER COLUMN reference_id SET DEFAULT nextval('reference_reference_id_seq'::regclass);


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

ALTER TABLE referencealtident ALTER COLUMN referencealtident_id SET DEFAULT nextval('referencealtident_referencealtident_id_seq'::regclass);


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

ALTER TABLE referencecontributor ALTER COLUMN referencecontributor_id SET DEFAULT nextval('referencecontributor_referencecontributor_id_seq'::regclass);


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

ALTER TABLE referencejournal ALTER COLUMN referencejournal_id SET DEFAULT nextval('referencejournal_referencejournal_id_seq'::regclass);


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

ALTER TABLE referenceparty ALTER COLUMN referenceparty_id SET DEFAULT nextval('referenceparty_referenceparty_id_seq'::regclass);


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

ALTER TABLE revision ALTER COLUMN revision_id SET DEFAULT nextval('revision_revision_id_seq'::regclass);


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

ALTER TABLE role ALTER COLUMN role_id SET DEFAULT nextval('role_role_id_seq'::regclass);


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

ALTER TABLE sizeclass ALTER COLUMN sizeclass_id SET DEFAULT nextval('sizeclass_sizeclass_id_seq'::regclass);


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

ALTER TABLE soilobs ALTER COLUMN soilobs_id SET DEFAULT nextval('soilobs_soilobs_id_seq'::regclass);


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

ALTER TABLE soiltaxon ALTER COLUMN soiltaxon_id SET DEFAULT nextval('soiltaxon_soiltaxon_id_seq'::regclass);


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

ALTER TABLE specimen ALTER COLUMN specimen_id SET DEFAULT nextval('specimen_specimen_id_seq'::regclass);


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

ALTER TABLE specimenreplicate ALTER COLUMN specimenreplicate_id SET DEFAULT nextval('specimenreplicate_specimenreplicate_id_seq'::regclass);


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

ALTER TABLE stemobservation ALTER COLUMN stemobservation_id SET DEFAULT nextval('stemobservation_stemobservation_id_seq'::regclass);


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

ALTER TABLE stratum ALTER COLUMN stratum_id SET DEFAULT nextval('stratum_stratum_id_seq'::regclass);


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

ALTER TABLE stratummethod ALTER COLUMN stratummethod_id SET DEFAULT nextval('stratummethod_stratummethod_id_seq'::regclass);


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

ALTER TABLE stratumtype ALTER COLUMN stratumtype_id SET DEFAULT nextval('stratumtype_stratumtype_id_seq'::regclass);


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

ALTER TABLE taxonalt ALTER COLUMN taxonalt_id SET DEFAULT nextval('taxonalt_taxonalt_id_seq'::regclass);


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

ALTER TABLE taxondetermination ALTER COLUMN taxondetermination_id SET DEFAULT nextval('taxondetermination_taxondetermination_id_seq'::regclass);


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

ALTER TABLE taxonoccurrence ALTER COLUMN taxonoccurrence_id SET DEFAULT nextval('taxonoccurrence_taxonoccurrence_id_seq'::regclass);


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

ALTER TABLE telephone ALTER COLUMN telephone_id SET DEFAULT nextval('telephone_telephone_id_seq'::regclass);


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

ALTER TABLE temptbl_std_commnames ALTER COLUMN commconcept_id SET DEFAULT nextval('temptbl_std_commnames_commconcept_id_seq'::regclass);


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

ALTER TABLE temptbl_std_plantnames ALTER COLUMN plantconcept_id SET DEFAULT nextval('temptbl_std_plantnames_plantconcept_id_seq'::regclass);


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

ALTER TABLE trait ALTER COLUMN trait_id SET DEFAULT nextval('trait_trait_id_seq'::regclass);


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

ALTER TABLE usercertification ALTER COLUMN usercertification_id SET DEFAULT nextval('usercertification_usercertification_id_seq'::regclass);


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

ALTER TABLE userdataset ALTER COLUMN userdataset_id SET DEFAULT nextval('userdataset_userdataset_id_seq'::regclass);


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

ALTER TABLE userdatasetitem ALTER COLUMN userdatasetitem_id SET DEFAULT nextval('userdatasetitem_userdatasetitem_id_seq'::regclass);


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

ALTER TABLE userdefined ALTER COLUMN userdefined_id SET DEFAULT nextval('userdefined_userdefined_id_seq'::regclass);


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

ALTER TABLE usernotify ALTER COLUMN usernotify_id SET DEFAULT nextval('usernotify_usernotify_id_seq'::regclass);


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

ALTER TABLE userpermission ALTER COLUMN userpermission_id SET DEFAULT nextval('userpermission_userpermission_id_seq'::regclass);


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

ALTER TABLE userpreference ALTER COLUMN userpreference_id SET DEFAULT nextval('userpreference_userpreference_id_seq'::regclass);


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

ALTER TABLE userquery ALTER COLUMN userquery_id SET DEFAULT nextval('userquery_userquery_id_seq'::regclass);


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

ALTER TABLE userrecordowner ALTER COLUMN userrecordowner_id SET DEFAULT nextval('userrecordowner_userrecordowner_id_seq'::regclass);


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

ALTER TABLE userregionalexp ALTER COLUMN userregionalexp_id SET DEFAULT nextval('userregionalexp_userregionalexp_id_seq'::regclass);


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

ALTER TABLE usr ALTER COLUMN usr_id SET DEFAULT nextval('usr_usr_id_seq'::regclass);


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

ALTER TABLE voucher ALTER COLUMN voucher_id SET DEFAULT nextval('voucher_voucher_id_seq'::regclass);


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_keys UNIQUE (commname_id);


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY commname
    ADD CONSTRAINT commname_keys UNIQUE (commname);


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY morphospecies
    ADD CONSTRAINT morphospecies_keys UNIQUE (locationevent_id, name);


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

ALTER TABLE ONLY morphospecies
    ADD CONSTRAINT morphospecies_pkey PRIMARY KEY (morphospecies_id);


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY plotmethod
    ADD CONSTRAINT plotmethod_pkey PRIMARY KEY (plotmethod_id);


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY soilobs
    ADD CONSTRAINT soilobs_keys UNIQUE (locationevent_id);


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY 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 ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_keys_collectionnumber UNIQUE (reference_id, collectioncode_dwc, collectionnumber);


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY 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 ONLY temptbl_std_plantnames
    ADD CONSTRAINT temptbl_std_plantnames_pkey PRIMARY KEY (plantconcept_id);


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

ALTER TABLE ONLY 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 USING btree (organization_id);


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

CREATE INDEX address_party_id_x ON address USING btree (party_id);


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

CREATE INDEX aggregateoccurrence_taxonoccurrence_id_x ON aggregateoccurrence USING btree (taxonoccurrence_id);


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

CREATE INDEX classcontributor_commclass_id_x ON classcontributor USING btree (commclass_id);


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

CREATE INDEX classcontributor_party_id_x ON classcontributor USING btree (party_id);


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

CREATE INDEX classcontributor_role_id_x ON classcontributor USING btree (role_id);


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

CREATE UNIQUE INDEX commclass_accessioncode_index ON commclass USING btree (accessioncode);


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

CREATE INDEX commclass_classpublication_id_x ON commclass USING btree (classpublication_id);


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

CREATE INDEX commclass_locationevent_id_x ON commclass USING btree (locationevent_id);


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

CREATE UNIQUE INDEX commconcept_accessioncode_index ON commconcept USING btree (accessioncode);


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

CREATE INDEX commconcept_commname_id_x ON commconcept USING btree (commname_id);


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

CREATE INDEX commconcept_dobscount_x ON commconcept USING btree (d_obscount);


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

CREATE INDEX commconcept_reference_id_x ON commconcept USING btree (reference_id);


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

CREATE INDEX commcorrelation_commconcept_id_x ON commcorrelation USING btree (commconcept_id);


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

CREATE INDEX commcorrelation_commstatus_id_x ON commcorrelation USING btree (commstatus_id);


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

CREATE INDEX commdetermination_commauthority_id_x ON commdetermination USING btree (commauthority_id);


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

CREATE INDEX commdetermination_commclass_id_x ON commdetermination USING btree (commclass_id);


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

CREATE INDEX commdetermination_commconcept_id_x ON commdetermination USING btree (commconcept_id);


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

CREATE INDEX commlineage_childcommstatus_id_x ON commlineage USING btree (childcommstatus_id);


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

CREATE INDEX commlineage_parentcommstatus_id_x ON commlineage USING btree (parentcommstatus_id);


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

CREATE INDEX commname_reference_id_x ON commname USING btree (reference_id);


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

CREATE UNIQUE INDEX commstatus_accessioncode_index ON commstatus USING btree (accessioncode);


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

CREATE INDEX commstatus_commconcept_id_x ON commstatus USING btree (commconcept_id);


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

CREATE INDEX commstatus_commlevel_x ON commstatus USING btree (commlevel);


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

CREATE INDEX commstatus_commparent_id_x ON commstatus USING btree (commparent_id);


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

CREATE INDEX commstatus_party_id_x ON commstatus USING btree (party_id);


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

CREATE INDEX commstatus_reference_id_x ON commstatus USING btree (reference_id);


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

CREATE INDEX commusage_classsystem_x ON commusage USING btree (classsystem);


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

CREATE INDEX commusage_commconcept_id_x ON commusage USING btree (commconcept_id);


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

CREATE INDEX commusage_commname_id_x ON commusage USING btree (commname_id);


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

CREATE INDEX commusage_commname_x ON commusage USING btree (commname);


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

CREATE INDEX commusage_commstatus_id_x ON commusage USING btree (commstatus_id);


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

CREATE INDEX commusage_party_id_x ON commusage USING btree (party_id);


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

CREATE INDEX coverindex_covermethod_id_x ON coverindex USING btree (covermethod_id);


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

CREATE UNIQUE INDEX covermethod_accessioncode_index ON covermethod USING btree (accessioncode);


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

CREATE INDEX covermethod_reference_id_x ON covermethod USING btree (reference_id);


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

CREATE UNIQUE INDEX dba_datacache_key ON dba_datacache USING btree (cache_key);


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

CREATE INDEX definedvalue_userdefined_id_x ON definedvalue USING btree (userdefined_id);


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

CREATE INDEX disturbanceobs_locationevent_id_x ON disturbanceobs USING btree (locationevent_id);


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

CREATE INDEX emb_aggregateoccurrence_idx ON aggregateoccurrence USING btree (emb_aggregateoccurrence);


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

CREATE INDEX emb_classcontributor_idx ON classcontributor USING btree (emb_classcontributor);


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

CREATE INDEX emb_commclass_idx ON commclass USING btree (emb_commclass);


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

CREATE INDEX emb_commdetermination_idx ON commdetermination USING btree (emb_commdetermination);


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

CREATE INDEX emb_disturbanceobs_idx ON disturbanceobs USING btree (emb_disturbanceobs);


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

CREATE INDEX emb_location_idx ON location USING btree (emb_location);


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

CREATE INDEX emb_locationevent_idx ON locationevent USING btree (emb_locationevent);


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

CREATE INDEX emb_plantobservation_idx ON plantobservation USING btree (emb_plantobservation);


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

CREATE INDEX emb_soilobs_idx ON soilobs USING btree (emb_soilobs);


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

CREATE INDEX emb_stemobservation_idx ON stemobservation USING btree (emb_stemobservation);


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

CREATE INDEX emb_taxonalt_idx ON taxonalt USING btree (emb_taxonalt);


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

CREATE INDEX emb_taxondetermination_idx ON taxondetermination USING btree (emb_taxondetermination);


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

CREATE INDEX emb_taxonoccurrence_idx ON taxonoccurrence USING btree (emb_taxonoccurrence);


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

CREATE INDEX embargo_location_id_x ON embargo USING btree (location_id);


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

CREATE INDEX fki_aggregateoccurrence_plantobservation_id ON aggregateoccurrence USING btree (plantobservation_id);


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

CREATE INDEX fki_aggregateoccurrence_stratum_id ON aggregateoccurrence USING btree (stratum_id);


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

CREATE INDEX fki_locationevent_plotmethod_id ON locationevent USING btree (plotmethod_id);


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

CREATE INDEX fki_plantobservation_plant_id ON plantobservation USING btree (plant_id);


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

CREATE INDEX fki_planttag_plant_id ON planttag USING btree (plantobservation_id);


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

CREATE INDEX fki_planttag_plantobservation_id ON planttag USING btree (plantobservation_id);


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

CREATE INDEX fki_plotmethod_reference_id ON plotmethod USING btree (reference_id);


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

CREATE INDEX fki_specimenreplicate_museum_id ON specimenreplicate USING btree (museum_id);


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

CREATE INDEX fki_specimenreplicate_reference_id_fkey ON specimenreplicate USING btree (reference_id);


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

CREATE INDEX fki_specimenreplicate_specimen_id ON specimenreplicate USING btree (specimen_id);


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

CREATE INDEX fki_taxondetermination_morphospecies_id ON taxondetermination USING btree (morphospecies_id);


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

CREATE UNIQUE INDEX graphic_accessioncode_index ON graphic USING btree (accessioncode);


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

CREATE INDEX graphic_locationevent_id_x ON graphic USING btree (locationevent_id);


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

CREATE INDEX keywords_table_id_entity_key ON keywords USING btree (table_id, entity);


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

CREATE UNIQUE INDEX location_accessioncode_index ON location USING btree (accessioncode);


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

CREATE INDEX location_parent_id_x ON location USING btree (parent_id);


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

CREATE INDEX location_reference_id_x ON location USING btree (reference_id);


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

CREATE UNIQUE INDEX locationevent_accessioncode_index ON locationevent USING btree (accessioncode);


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

CREATE INDEX locationevent_covermethod_id_x ON locationevent USING btree (covermethod_id);


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

CREATE INDEX locationevent_location_id_x ON locationevent USING btree (location_id);


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

CREATE INDEX locationevent_previousobs_id_x ON locationevent USING btree (previous_id);


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

CREATE INDEX locationevent_project_id_x ON locationevent USING btree (project_id);


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

CREATE INDEX locationevent_soiltaxon_id_x ON locationevent USING btree (soiltaxon_id);


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

CREATE INDEX locationeventcontributor_locationevent_id_x ON locationeventcontributor USING btree (locationevent_id);


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

CREATE INDEX locationeventcontributor_party_id_x ON locationeventcontributor USING btree (party_id);


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

CREATE INDEX locationeventcontributor_role_id_x ON locationeventcontributor USING btree (role_id);


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

CREATE UNIQUE INDEX locationeventsynonym_accessioncode_index ON locationeventsynonym USING btree (accessioncode);


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

CREATE INDEX locationeventsynonym_party_id_x ON locationeventsynonym USING btree (party_id);


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

CREATE INDEX locationeventsynonym_primarylocationevent_id_x ON locationeventsynonym USING btree (primarylocationevent_id);


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

CREATE INDEX locationeventsynonym_role_id_x ON locationeventsynonym USING btree (role_id);


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

CREATE INDEX locationeventsynonym_synonymlocationevent_id_x ON locationeventsynonym USING btree (synonymlocationevent_id);


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

CREATE INDEX locationplace_location_id_x ON locationplace USING btree (location_id);


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

CREATE INDEX locationplace_namedplace_id_x ON locationplace USING btree (namedplace_id);


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

CREATE UNIQUE INDEX namedplace_accessioncode_index ON namedplace USING btree (accessioncode);


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

CREATE INDEX namedplace_reference_id_x ON namedplace USING btree (reference_id);


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

CREATE UNIQUE INDEX note_accessioncode_index ON note USING btree (accessioncode);


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

CREATE INDEX note_notelink_id_x ON note USING btree (notelink_id);


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

CREATE INDEX note_party_id_x ON note USING btree (party_id);


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

CREATE INDEX note_role_id_x ON note USING btree (role_id);


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

CREATE UNIQUE INDEX party_accessioncode_index ON party USING btree (accessioncode);


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

CREATE INDEX party_currentname_id_x ON party USING btree (currentname_id);


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

CREATE INDEX party_givenname ON party USING btree (givenname);


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

CREATE UNIQUE INDEX party_keys ON party USING btree ((COALESCE(givenname, ''::text)), (COALESCE(middlename, ''::text)), (COALESCE(surname, ''::text)), (COALESCE(organizationname, ''::text)));


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

CREATE INDEX party_middlename ON party USING btree (middlename);


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

CREATE INDEX party_organizationname ON party USING btree (organizationname);


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

CREATE INDEX party_surname ON party USING btree (surname);


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

CREATE INDEX partymember_childparty_id_x ON partymember USING btree (childparty_id);


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

CREATE INDEX partymember_parentparty_id_x ON partymember USING btree (parentparty_id);


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

CREATE INDEX partymember_role_id_x ON partymember USING btree (role_id);


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

CREATE UNIQUE INDEX plantconcept_accessioncode_index ON plantconcept USING btree (accessioncode);


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

CREATE INDEX plantconcept_dobscount_x ON plantconcept USING btree (d_obscount);


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

CREATE UNIQUE INDEX plantconcept_keys ON plantconcept USING btree ((COALESCE(reference_id, 0)), plantname_id);


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

CREATE INDEX plantconcept_plantname_id_x ON plantconcept USING btree (plantname_id);


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

CREATE INDEX plantconcept_reference_id_x ON plantconcept USING btree (reference_id);


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

CREATE INDEX plantcorrelation_plantconcept_id_x ON plantcorrelation USING btree (plantconcept_id);


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

CREATE INDEX plantcorrelation_plantstatus_id_x ON plantcorrelation USING btree (plantstatus_id);


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

CREATE INDEX plantlineage_childplantstatus_id_x ON plantlineage USING btree (childplantstatus_id);


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

CREATE INDEX plantlineage_parentplantstatus_id_x ON plantlineage USING btree (parentplantstatus_id);


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

CREATE INDEX plantname_plantname_x ON plantname USING btree (plantname);


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

CREATE INDEX plantname_reference_id_x ON plantname USING btree (reference_id);


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

CREATE UNIQUE INDEX plantstatus_accessioncode_index ON plantstatus USING btree (accessioncode);


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

CREATE INDEX plantstatus_party_id_x ON plantstatus USING btree (party_id);


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

CREATE INDEX plantstatus_plantconcept_id_x ON plantstatus USING btree (plantconcept_id);


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

CREATE INDEX plantstatus_plantlevel_x ON plantstatus USING btree (plantlevel);


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

CREATE INDEX plantstatus_plantparent_id_x ON plantstatus USING btree (plantparent_id);


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

CREATE INDEX plantstatus_reference_id_x ON plantstatus USING btree (reference_id);


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

CREATE INDEX plantusage_classsystem_x ON plantusage USING btree (classsystem);


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

CREATE INDEX plantusage_party_id_x ON plantusage USING btree (party_id);


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

CREATE INDEX plantusage_plantconcept_id_x ON plantusage USING btree (plantconcept_id);


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

CREATE INDEX plantusage_plantname_id_x ON plantusage USING btree (plantname_id);


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

CREATE INDEX plantusage_plantname_x ON plantusage USING btree (plantname);


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

CREATE INDEX plantusage_plantstatus_id_x ON plantusage USING btree (plantstatus_id);


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

CREATE UNIQUE INDEX plotmethod_accessioncode ON plotmethod USING btree (accessioncode);


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

CREATE UNIQUE INDEX project_accessioncode_index ON project USING btree (accessioncode);


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

CREATE INDEX projectcontributor_party_id_x ON projectcontributor USING btree (party_id);


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

CREATE INDEX projectcontributor_project_id_x ON projectcontributor USING btree (project_id);


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

CREATE INDEX projectcontributor_role_id_x ON projectcontributor USING btree (role_id);


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

CREATE UNIQUE INDEX reference_accessioncode_index ON reference USING btree (accessioncode);


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

CREATE INDEX reference_referencejournal_id_x ON reference USING btree (referencejournal_id);


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

CREATE INDEX referencealtident_reference_id_x ON referencealtident USING btree (reference_id);


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

CREATE INDEX referencecontributor_reference_id_x ON referencecontributor USING btree (reference_id);


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

CREATE INDEX referencecontributor_referenceparty_id_x ON referencecontributor USING btree (referenceparty_id);


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

CREATE UNIQUE INDEX referencejournal_accessioncode_index ON referencejournal USING btree (accessioncode);


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

CREATE UNIQUE INDEX referenceparty_accessioncode_index ON referenceparty USING btree (accessioncode);


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

CREATE INDEX referenceparty_currentparty_id_x ON referenceparty USING btree (currentparty_id);


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

CREATE INDEX revision_previousrevision_id_x ON revision USING btree (previousrevision_id);


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

CREATE UNIQUE INDEX role_accessioncode_index ON role USING btree (accessioncode);


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

CREATE INDEX soilobs_locationevent_id_x ON soilobs USING btree (locationevent_id);


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

CREATE UNIQUE INDEX soiltaxon_accessioncode_index ON soiltaxon USING btree (accessioncode);


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

CREATE INDEX soiltaxon_soilparent_id_x ON soiltaxon USING btree (soilparent_id);


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

CREATE INDEX stemobservation_plantobservation_id_x ON stemobservation USING btree (plantobservation_id);


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

CREATE INDEX stratum_locationevent_id_x ON stratum USING btree (locationevent_id);


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

CREATE INDEX stratum_stratumtype_id_x ON stratum USING btree (stratumtype_id);


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

CREATE UNIQUE INDEX stratummethod_accessioncode_index ON stratummethod USING btree (accessioncode);


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

CREATE INDEX stratummethod_reference_id_x ON stratummethod USING btree (reference_id);


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

CREATE INDEX stratumtype_stratummethod_id_x ON stratumtype USING btree (stratummethod_id);


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

CREATE INDEX taxonalt_plantconcept_id_x ON taxonalt USING btree (plantconcept_id);


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

CREATE INDEX taxonalt_taxondetermination_id_x ON taxonalt USING btree (taxondetermination_id);


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

CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination USING btree (accessioncode);


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

CREATE UNIQUE INDEX taxondetermination_keys ON taxondetermination USING btree (taxonoccurrence_id, role_id, (COALESCE(party_id, 0)), plantconcept_id);


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

CREATE INDEX taxondetermination_party_id_x ON taxondetermination USING btree (party_id);


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

CREATE INDEX taxondetermination_plantconcept_id_x ON taxondetermination USING btree (plantconcept_id);


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

CREATE INDEX taxondetermination_reference_id_x ON taxondetermination USING btree (reference_id);


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

CREATE INDEX taxondetermination_role_id_x ON taxondetermination USING btree (role_id);


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

CREATE INDEX taxondetermination_taxonoccurrence_id_x ON taxondetermination USING btree (taxonoccurrence_id);


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

CREATE UNIQUE INDEX taxonoccurrence_accessioncode_index ON taxonoccurrence USING btree (accessioncode);


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

CREATE INDEX taxonoccurrence_locationevent_id_x ON taxonoccurrence USING btree (locationevent_id);


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

CREATE INDEX taxonoccurrence_reference_id_x ON taxonoccurrence USING btree (reference_id);


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

CREATE INDEX telephone_party_id_x ON telephone USING btree (party_id);


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

CREATE INDEX usercertification_usr_id_x ON usercertification USING btree (usr_id);


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

CREATE UNIQUE INDEX userdataset_accessioncode_index ON userdataset USING btree (accessioncode);


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

CREATE INDEX userdataset_usr_id_x ON userdataset USING btree (usr_id);


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

CREATE INDEX userdatasetitem2_accessioncode_index ON userdatasetitem USING btree (externalaccessioncode);


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

CREATE INDEX userdatasetitem_accessioncode_index ON userdatasetitem USING btree (itemaccessioncode);


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

CREATE INDEX userdatasetitem_userdataset_id_x ON userdatasetitem USING btree (userdataset_id);


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

CREATE UNIQUE INDEX userdefined_accessioncode_index ON userdefined USING btree (accessioncode);


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

CREATE INDEX usernotify_usr_id_x ON usernotify USING btree (usr_id);


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

CREATE INDEX userpermission_embargo_id_x ON userpermission USING btree (embargo_id);


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

CREATE INDEX userpermission_usr_id_x ON userpermission USING btree (usr_id);


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

CREATE INDEX userpreference_usr_id_x ON userpreference USING btree (usr_id);


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

CREATE UNIQUE INDEX userquery_accessioncode_index ON userquery USING btree (accessioncode);


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

CREATE INDEX userquery_usr_id_x ON userquery USING btree (usr_id);


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

CREATE INDEX userrecordowner_usr_id_x ON userrecordowner USING btree (usr_id);


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

CREATE INDEX userregionalexp_usercertification_id_x ON userregionalexp USING btree (usercertification_id);


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

CREATE INDEX usr_party_id_x ON usr USING btree (party_id);


--
-- Name: aggregateoccurrence_plantobs_count_1; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER aggregateoccurrence_plantobs_count_1 BEFORE INSERT OR UPDATE ON aggregateoccurrence FOR EACH ROW EXECUTE PROCEDURE aggregateoccurrence_plantobs_count_1();


--
-- Name: address_organization_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT classcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: classcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_classpublication_id FOREIGN KEY (classpublication_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commclass_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commcorrelation_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_commauthority_id FOREIGN KEY (commauthority_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY commname
    ADD CONSTRAINT commname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: coverindex_covermethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY covermethod
    ADD CONSTRAINT covermethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: definedvalue_userdefined_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_covermethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY locationevent
    ADD CONSTRAINT locationevent_location_id FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_plotmethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_plotmethod_id FOREIGN KEY (plotmethod_id) REFERENCES plotmethod(plotmethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_previousobs_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_primarylocationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY locationplace
    ADD CONSTRAINT locationplace_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: morphospecies_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY morphospecies
    ADD CONSTRAINT morphospecies_locationevent_id FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: namedplace_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY namedplace
    ADD CONSTRAINT namedplace_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: namedplacecorrelation_childplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: note_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY plantconcept
    ADD CONSTRAINT plantconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantcorrelation_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY plantname
    ADD CONSTRAINT plantname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantobservation_plant_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT plantstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantstatus_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT plantstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: planttag_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY plantusage
    ADD CONSTRAINT plantusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantusage_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY plantusage
    ADD CONSTRAINT plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotmethod_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotmethod
    ADD CONSTRAINT plotmethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: project_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: projectcontributor_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT projectcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: projectcontributor_project_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY stratummethod
    ADD CONSTRAINT stratummethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratumtype_stratummethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY taxonalt
    ADD CONSTRAINT taxonalt_taxondetermination_id FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_morphospecies_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_morphospecies_id FOREIGN KEY (morphospecies_id) REFERENCES morphospecies(morphospecies_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_plantconcept_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: telephone_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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 ONLY 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: -
--

ALTER TABLE ONLY usr
    ADD CONSTRAINT usr_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: voucher_specimenreplicate_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY 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 ONLY voucher
    ADD CONSTRAINT voucher_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

