--
-- 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;

SET search_path = public, pg_catalog;

--
-- 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 character varying(50),
    email character varying(100),
    deliverypoint character varying(200),
    city character varying(50),
    administrativearea character varying(50),
    postalcode character varying(10),
    country character varying(50),
    currentflag 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,
    taxonbin_id integer,
    cover double precision,
    basalarea double precision,
    biomass double precision,
    inferencearea double precision,
    stratumbase double precision,
    stratumheight double precision,
    emb_aggregateoccurrence integer,
    covercode character varying(10),
    count integer NOT NULL
);


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

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


--
-- 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: aux_role; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

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


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

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


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

ALTER SEQUENCE aux_role_role_id_seq OWNED BY aux_role.role_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,
    plotevent_id integer NOT NULL,
    inspection boolean,
    tableanalysis boolean,
    multivariateanalysis boolean,
    classpublication_id integer,
    classnotes text,
    commname character varying(200),
    commcode character varying(200),
    commframework character varying(200),
    commlevel character varying(200),
    classstartdate timestamp with time zone,
    classstopdate timestamp with time zone,
    emb_commclass integer,
    expertsystem text,
    accessioncode character varying(255)
);


--
-- 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 character varying(255)
);


--
-- 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 character varying(20) 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 character varying(34),
    commname character varying(200),
    classfit character varying(50),
    classconfidence character varying(15),
    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 character varying(20) NOT NULL,
    commparent_id integer,
    commlevel character varying(80),
    commpartycomments text,
    party_id integer NOT NULL,
    startdate timestamp with time zone NOT NULL,
    stopdate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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 character varying(20),
    classsystem character varying(50),
    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 character varying(10) NOT NULL,
    upperlimit double precision,
    lowerlimit double precision,
    coverpercent double precision NOT NULL,
    indexdescription text
);


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

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 character varying(30) NOT NULL,
    coverestimationmethod character varying(80),
    accessioncode character varying(255)
);


--
-- 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 character varying(100),
    confidentialityshorttext character varying(100)
);


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

CREATE TABLE dba_cookie (
    cookie_id integer NOT NULL,
    cookiename character varying(75) NOT NULL,
    defaultvalue character varying(75) NOT NULL,
    viewname character varying(25) 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 character varying(50) 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 character varying(200) NOT NULL,
    cache_label character varying(200),
    cache_order double precision,
    data1 character varying(255),
    data2 character varying(255),
    data3 character varying(255),
    data4 character varying(255),
    data5 character varying(255),
    data6 character varying(255),
    data7 character varying(255),
    data8 character varying(255),
    data9 character varying(255),
    data10 character varying(255)
);


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

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 character varying(20) 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 character varying(100),
    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 character varying(75),
    fieldname character varying(75),
    fieldlabel character varying(200),
    fieldmodel character varying(50),
    fieldnulls character varying(10),
    fieldtype character varying(30),
    fieldkey character varying(10),
    fieldreferences character varying(200),
    fieldlist character varying(50),
    fieldnotes text,
    fielddefinition text,
    fieldkeywords text
);


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

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 character varying(75),
    fieldname character varying(75),
    listvalue character varying(255),
    listvaluedescription text,
    listvaluesortorder double precision
);


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

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 character varying(20) NOT NULL,
    tableabbrev character varying(10) NOT NULL,
    confirmcode character varying(70) 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 character varying(255)
);


--
-- 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 character varying(75),
    tablelabel character varying(200),
    tablenotes text,
    tabledescription text,
    tablekeywords text
);


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

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 character varying(255)
);


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,
    plotevent_id integer NOT NULL,
    disturbancetype character varying(30) NOT NULL,
    disturbanceintensity character varying(30),
    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,
    plot_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,
    plotevent_id integer NOT NULL,
    graphicname character varying(30),
    graphiclocation text,
    graphicdescription text,
    graphictype character varying(20),
    graphicdata oid,
    graphicdate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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: individualplant; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE individualplant (
    individualplant_id integer NOT NULL,
    aggregateoccurrence_id integer NOT NULL,
    diameter double precision,
    diameteraccuracy double precision,
    height double precision,
    heightaccuracy double precision,
    taxonarea double precision,
    emb_individualplant integer,
    authorcode character varying(20)
);


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

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


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

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


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

ALTER SEQUENCE individualplant_individualplant_id_seq OWNED BY individualplant.individualplant_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: namedplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

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


--
-- 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 character varying(20) 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 character varying(20) NOT NULL,
    notetext text NOT NULL,
    notedate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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 character varying(50) NOT NULL,
    attributename character varying(50),
    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 character varying(20),
    givenname character varying(50),
    middlename character varying(50),
    surname character varying(50),
    organizationname character varying(100),
    currentname_id integer,
    contactinstructions text,
    email character varying(120),
    partytype character varying(40),
    partypublic boolean DEFAULT true,
    d_obscount integer,
    accessioncode character varying(255)
);


--
-- 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;


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

CREATE TABLE place (
    plotplace_id integer NOT NULL,
    plot_id integer NOT NULL,
    calculated boolean,
    namedplace_id integer NOT NULL
);


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

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


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

ALTER SEQUENCE place_plotplace_id_seq OWNED BY place.plotplace_id;


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

CREATE TABLE plantconcept (
    plantconcept_id integer NOT NULL,
    plantname_id integer NOT NULL,
    reference_id integer NOT NULL,
    plantname character varying(200),
    plantcode character varying(23),
    plantdescription text,
    d_obscount integer,
    d_currentaccepted boolean,
    accessioncode character varying(255)
);


--
-- 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 character varying(20) 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 character varying(255) 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: plantstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantstatus (
    plantstatus_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    reference_id integer,
    plantconceptstatus character varying(20) NOT NULL,
    plantpartycomments text,
    plantparentname character varying(200),
    plantparentconcept_id integer,
    plantparent_id integer,
    plantlevel character varying(80),
    party_id integer NOT NULL,
    startdate timestamp with time zone NOT NULL,
    stopdate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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;


--
-- 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 character varying(20),
    plantname character varying(220),
    classsystem character varying(50),
    acceptedsynonym character varying(220),
    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: plot; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plot (
    plot_id integer NOT NULL,
    authorcode character varying(30),
    reference_id integer,
    parent_id integer,
    reallatitude double precision,
    reallongitude double precision,
    locationaccuracy double precision,
    confidentialitystatus integer NOT NULL,
    confidentialityreason character varying(200),
    latitude double precision,
    longitude double precision,
    authore character varying(20),
    authorn character varying(20),
    authorzone character varying(20),
    authordatum character varying(20),
    authorlocation character varying(200),
    locationnarrative text,
    azimuth double precision,
    dsgpoly text,
    shape character varying(50),
    area double precision,
    standsize character varying(50),
    placementmethod character varying(50),
    permanence 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 character varying(90),
    landform character varying(50),
    surficialdeposits character varying(90),
    rocktype character varying(90),
    stateprovince character varying(55),
    country character varying(100),
    submitter_surname character varying(100),
    submitter_givenname character varying(100),
    submitter_email character varying(100),
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    dateentered timestamp with time zone DEFAULT now(),
    emb_plot integer,
    plotrationalenarrative text,
    accessioncode character varying(255),
    subplotxposition double precision,
    subplotyposition double precision,
    namedplace_id integer
);


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

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


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

ALTER SEQUENCE plot_plot_id_seq OWNED BY plot.plot_id;


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

CREATE TABLE plotevent (
    plotevent_id integer NOT NULL,
    previous_id integer,
    plot_id integer NOT NULL,
    project_id integer,
    authorcode character varying(30),
    dateaccuracy character varying(30),
    covermethod_id integer,
    coverdispersion character varying(30),
    autotaxoncover boolean,
    stratummethod_id integer,
    methodnarrative text,
    taxonoccurrencearea double precision,
    stemsizelimit double precision,
    stemarea double precision,
    stemsamplemethod character varying(30),
    originaldata text,
    effortlevel character varying(30),
    plotvalidationlevel integer,
    floristicquality character varying(30),
    bryophytequality character varying(30),
    lichenquality character varying(30),
    ploteventnarrative text,
    landscapenarrative text,
    homogeneity character varying(50),
    phenologicaspect character varying(30),
    representativeness character varying(255),
    standmaturity character varying(50),
    successionalstatus text,
    basalarea double precision,
    hydrologicregime character varying(30),
    soilmoistureregime character varying(30),
    soildrainage character varying(30),
    watersalinity character varying(30),
    waterdepth double precision,
    shoredistance double precision,
    soildepth double precision,
    organicdepth double precision,
    soiltaxon_id integer,
    soiltaxonsrc character varying(200),
    percentbedrock double precision,
    percentrockgravel double precision,
    percentwood double precision,
    percentlitter double precision,
    percentbaresoil double precision,
    percentwater double precision,
    percentother double precision,
    nameother character varying(30),
    treeht double precision,
    shrubht double precision,
    fieldht double precision,
    nonvascularht double precision,
    submergedht double precision,
    treecover double precision,
    shrubcover double precision,
    fieldcover double precision,
    nonvascularcover double precision,
    floatingcover double precision,
    submergedcover double precision,
    dominantstratum character varying(40),
    growthform1type character varying(40),
    growthform2type character varying(40),
    growthform3type character varying(40),
    growthform1cover double precision,
    growthform2cover double precision,
    growthform3cover double precision,
    totalcover double precision,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    obsstartdate timestamp with time zone,
    obsenddate timestamp with time zone,
    dateentered timestamp with time zone DEFAULT now(),
    emb_plotevent 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 character varying(255),
    toptaxon2name character varying(255),
    toptaxon3name character varying(255),
    toptaxon4name character varying(255),
    toptaxon5name character varying(255),
    numberoftaxa integer,
    accessioncode character varying(255)
);


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

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


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

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


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

ALTER SEQUENCE plotevent_plotevent_id_seq OWNED BY plotevent.plotevent_id;


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

CREATE TABLE ploteventcontributor (
    ploteventcontributor_id integer NOT NULL,
    plotevent_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    contributiondate timestamp with time zone
);


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

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


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

ALTER SEQUENCE ploteventcontributor_ploteventcontributor_id_seq OWNED BY ploteventcontributor.ploteventcontributor_id;


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

CREATE TABLE ploteventsynonym (
    ploteventsynonym_id integer NOT NULL,
    synonymplotevent_id integer NOT NULL,
    primaryplotevent_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 character varying(255)
);


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

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


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

ALTER SEQUENCE ploteventsynonym_ploteventsynonym_id_seq OWNED BY ploteventsynonym.ploteventsynonym_id;


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

CREATE TABLE project (
    project_id integer NOT NULL,
    projectname character varying(150) NOT NULL,
    projectdescription text,
    startdate timestamp with time zone,
    stopdate timestamp with time zone,
    d_obscount integer,
    d_lastplotaddeddate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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 character varying(50),
    cheatrole character varying(50)
);


--
-- 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 character varying(250),
    fulltext text,
    referencetype character varying(250),
    title character varying(250),
    titlesuperior character varying(250),
    referencejournal_id integer,
    volume character varying(250),
    issue character varying(250),
    pagerange character varying(250),
    totalpages integer,
    publisher character varying(250),
    publicationplace character varying(250),
    isbn character varying(250),
    edition character varying(250),
    numberofvolumes integer,
    chapternumber integer,
    reportnumber integer,
    communicationtype character varying(250),
    degree character varying(250),
    url text,
    doi text,
    additionalinfo text,
    pubdate timestamp with time zone,
    accessdate timestamp with time zone,
    conferencedate timestamp with time zone,
    accessioncode character varying(255)
);


--
-- 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 character varying(250),
    identifier character varying(250) 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 character varying(250),
    "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 character varying(250) NOT NULL,
    issn character varying(250),
    abbreviation character varying(250),
    accessioncode character varying(255)
);


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

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 character varying(250),
    positionname character varying(250),
    salutation character varying(250),
    givenname character varying(250),
    surname character varying(250),
    suffix character varying(250),
    organizationname character varying(250),
    currentparty_id integer,
    accessioncode character varying(255)
);


--
-- 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 character varying(50) NOT NULL,
    tableattribute character varying(50) NOT NULL,
    tablerecord integer NOT NULL,
    previousvaluetext text NOT NULL,
    previousvaluetype character varying(20) 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;


SET default_with_oids = false;

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

CREATE TABLE sizeclass (
    sizeclass_id integer NOT NULL,
    diameter double precision,
    diameteraccuracy double precision,
    height double precision,
    heightaccuracy double precision,
    taxonarea double precision
);


--
-- 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,
    plotevent_id integer NOT NULL,
    soilhorizon character varying(15) NOT NULL,
    soildepthtop double precision,
    soildepthbottom double precision,
    soilcolor character varying(30),
    soilorganic double precision,
    soiltexture character varying(50),
    soilsand double precision,
    soilsilt double precision,
    soilclay double precision,
    soilcoarse double precision,
    soilph double precision,
    exchangecapacity double precision,
    basesaturation double precision,
    soildescription text,
    emb_soilobs 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 character varying(15),
    soilname character varying(100),
    soillevel integer,
    soilparent_id integer,
    soilframework character varying(33),
    accessioncode character varying(255)
);


--
-- 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,
    individualplant_id integer,
    reference_id integer NOT NULL,
    collectioncode_dwc character varying(255),
    catalognumber_dwc character varying(255),
    collectiondate timestamp with time zone,
    collector_id integer
);


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

COMMENT ON TABLE specimen IS 'A herbarium specimen. Contains Darwin Core specimen data.';


--
-- 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;


SET default_with_oids = true;

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

CREATE TABLE stem (
    stem_id integer NOT NULL,
    individualplant_id integer NOT NULL,
    authorcode character varying(20),
    xposition double precision,
    yposition double precision,
    health character varying(50),
    emb_stem integer,
    diameter double precision,
    height double precision,
    heightaccuracy double precision,
    age double precision
);


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

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


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

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


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

ALTER SEQUENCE stem_stem_id_seq OWNED BY stem.stem_id;


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

CREATE TABLE stratum (
    stratum_id integer NOT NULL,
    plotevent_id integer NOT NULL,
    stratumtype_id integer NOT NULL,
    stratummethod_id integer,
    stratumname character varying(30),
    stratumheight double precision,
    stratumbase double precision,
    stratumcover double precision,
    stratumdescription character varying(200)
);


--
-- 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 character varying(30) NOT NULL,
    stratummethoddescription text,
    stratumassignment character varying(50),
    accessioncode character varying(255)
);


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

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 character varying(10),
    stratumname character varying(30),
    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 character varying(50),
    taxonaltconfidence character varying(50),
    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: taxonbin; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonbin (
    taxonbin_id integer NOT NULL,
    label character varying(255) NOT NULL,
    stratum_id integer,
    sizeclass_id integer,
    coverindex_id integer
);


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

COMMENT ON TABLE taxonbin IS 'Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.';


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

CREATE TABLE taxondetermination (
    taxondetermination_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    individualplant_id integer,
    plantconcept_id integer,
    plantname_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    determinationtype character varying(30),
    reference_id integer,
    originaldetermination boolean NOT NULL,
    currentdetermination boolean NOT NULL,
    taxonfit character varying(50),
    taxonconfidence character varying(50),
    museum_id integer,
    museumaccessionnumber character varying(100),
    grouptype character varying(20),
    notes text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    determinationdate timestamp with time zone NOT NULL,
    emb_taxondetermination integer,
    accessioncode character varying(255),
    specimen_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,
    plotevent_id integer NOT NULL,
    authorplantname character varying(255),
    reference_id integer,
    taxoninferencearea double precision,
    emb_taxonoccurrence integer,
    int_origplantconcept_id integer,
    int_origplantscifull character varying(255),
    int_origplantscinamenoauth character varying(255),
    int_origplantcommon character varying(255),
    int_origplantcode character varying(255),
    int_currplantconcept_id integer,
    int_currplantscifull character varying(255),
    int_currplantscinamenoauth character varying(255),
    int_currplantcommon character varying(255),
    int_currplantcode character varying(255),
    accessioncode character varying(255)
);


--
-- 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 character varying(30) NOT NULL,
    phonetype character varying(20) 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 character varying(255),
    translated character varying(255),
    code character varying(255),
    common character varying(255)
);


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

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 character varying(255),
    sciname character varying(255),
    scinamenoauth character varying(255),
    code character varying(255),
    common character varying(255)
);


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

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,
    stem_id integer NOT NULL,
    type character varying(255) NOT NULL,
    value character varying(255)
);


--
-- 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 character varying(50),
    degree_year character varying(50),
    degree_institution character varying(50),
    current_org character varying(50),
    current_pos character varying(200),
    esa_member 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 character varying(120),
    esa_sponsor_email_a character varying(120),
    esa_sponsor_name_b character varying(120),
    esa_sponsor_email_b character varying(120),
    peer_review boolean,
    addl_stmt text,
    certificationstatus character varying(30),
    certificationstatuscomments text,
    exp_region_a text,
    exp_region_b text,
    exp_region_c text,
    exp_region_a_veg text,
    exp_region_b_veg text,
    exp_region_c_veg text,
    exp_region_a_flor text,
    exp_region_b_flor text,
    exp_region_c_flor text,
    exp_region_a_nvc text,
    exp_region_b_nvc text,
    exp_region_c_nvc text
);


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

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 character varying(100) NOT NULL,
    datasetdescription text,
    datasettype character varying(50),
    datasetsharing character varying(30),
    datasetpassword character varying(50),
    datasetstop timestamp with time zone,
    datasetstart timestamp with time zone DEFAULT now(),
    accessioncode character varying(255)
);


--
-- 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 character varying(100) NOT NULL,
    itemtype character varying(50),
    notes text,
    itemstart timestamp with time zone DEFAULT now() NOT NULL,
    itemstop timestamp with time zone,
    externalaccessioncode character varying(100),
    itemdatabase character varying(50) NOT NULL,
    itemtable character varying(50) 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 character varying(50),
    userdefinedmetadata text,
    userdefinedcategory character varying(30),
    userdefinedtype character varying(20) NOT NULL,
    tablename character varying(50) NOT NULL,
    accessioncode character varying(255)
);


--
-- 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 character varying(100),
    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 character varying(100),
    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 character varying(100),
    querydescription text,
    querysql text,
    querytype character varying(50),
    querysharing character varying(30),
    querypassword character varying(50),
    querystop timestamp with time zone,
    querystart timestamp with time zone DEFAULT now(),
    accessioncode character varying(255)
);


--
-- 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 character varying(50) NOT NULL,
    tablerecord integer NOT NULL,
    ownertype character varying(30) 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 character varying(50) NOT NULL,
    vegetation character varying(50),
    floristics character varying(50),
    nvc_ivc character varying(50)
);


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

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 character varying(100) NOT NULL,
    preferred_name character varying(100),
    remote_address character varying(100),
    last_connect timestamp with time zone,
    begin_time timestamp with time zone,
    password character varying(512)
);


--
-- 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;


--
-- 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: role_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE aux_role ALTER COLUMN role_id SET DEFAULT nextval('aux_role_role_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: individualplant_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE individualplant ALTER COLUMN individualplant_id SET DEFAULT nextval('individualplant_individualplant_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: plotplace_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE place ALTER COLUMN plotplace_id SET DEFAULT nextval('place_plotplace_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: plantstatus_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE plantstatus ALTER COLUMN plantstatus_id SET DEFAULT nextval('plantstatus_plantstatus_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: plot_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE plot ALTER COLUMN plot_id SET DEFAULT nextval('plot_plot_id_seq'::regclass);


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

ALTER TABLE plotevent ALTER COLUMN plotevent_id SET DEFAULT nextval('plotevent_plotevent_id_seq'::regclass);


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

ALTER TABLE ploteventcontributor ALTER COLUMN ploteventcontributor_id SET DEFAULT nextval('ploteventcontributor_ploteventcontributor_id_seq'::regclass);


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

ALTER TABLE ploteventsynonym ALTER COLUMN ploteventsynonym_id SET DEFAULT nextval('ploteventsynonym_ploteventsynonym_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: 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: stem_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE stem ALTER COLUMN stem_id SET DEFAULT nextval('stem_stem_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: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

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


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

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id, taxonbin_id);


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

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


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

ALTER TABLE ONLY aux_role
    ADD CONSTRAINT aux_role_pkey PRIMARY KEY (role_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 (plotevent_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: individualplant_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY individualplant
    ADD CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id, authorcode);


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

ALTER TABLE ONLY individualplant
    ADD CONSTRAINT individualplant_pkey PRIMARY KEY (individualplant_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_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

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


--
-- 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: place_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_keys UNIQUE (plot_id, namedplace_id);


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

ALTER TABLE ONLY place
    ADD CONSTRAINT place_pkey PRIMARY KEY (plotplace_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: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

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


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

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


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

ALTER TABLE ONLY plot
    ADD CONSTRAINT plot_keys UNIQUE (reference_id, parent_id, authorcode);


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

ALTER TABLE ONLY plot
    ADD CONSTRAINT plot_pkey PRIMARY KEY (plot_id);


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

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_keys UNIQUE (plot_id, project_id, authorcode);


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

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_pkey PRIMARY KEY (plotevent_id);


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

ALTER TABLE ONLY ploteventcontributor
    ADD CONSTRAINT ploteventcontributor_pkey PRIMARY KEY (ploteventcontributor_id);


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

ALTER TABLE ONLY ploteventsynonym
    ADD CONSTRAINT ploteventsynonym_pkey PRIMARY KEY (ploteventsynonym_id);


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

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


--
-- 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: 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 (plotevent_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_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY specimen
    ADD CONSTRAINT specimen_keys UNIQUE (reference_id, collectioncode_dwc, catalognumber_dwc);


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

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


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

ALTER TABLE ONLY stem
    ADD CONSTRAINT stem_keys UNIQUE (individualplant_id, authorcode);


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

ALTER TABLE ONLY stem
    ADD CONSTRAINT stem_pkey PRIMARY KEY (stem_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: taxonbin_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonbin
    ADD CONSTRAINT taxonbin_pkey PRIMARY KEY (taxonbin_id);


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

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_keys UNIQUE (taxonoccurrence_id, individualplant_id, role_id, plantname_id, museumaccessionnumber);


--
-- 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: 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_taxonbin_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_taxonbin_id_x ON aggregateoccurrence USING btree (taxonbin_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: aux_role_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX aux_role_accessioncode_index ON aux_role USING btree (accessioncode);


--
-- 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_plotevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commclass_plotevent_id_x ON commclass USING btree (plotevent_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_plotevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX disturbanceobs_plotevent_id_x ON disturbanceobs USING btree (plotevent_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_individualplant_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emb_individualplant_idx ON individualplant USING btree (emb_individualplant);


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

CREATE INDEX emb_plot_idx ON plot USING btree (emb_plot);


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

CREATE INDEX emb_plotevent_idx ON plotevent USING btree (emb_plotevent);


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

CREATE INDEX emb_soilobs_idx ON soilobs USING btree (emb_soilobs);


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

CREATE INDEX emb_stem_idx ON stem USING btree (emb_stem);


--
-- 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_plot_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX embargo_plot_id_x ON embargo USING btree (plot_id);


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

CREATE INDEX fki_plot_namedplace_id ON plot USING btree (namedplace_id);


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

CREATE INDEX fki_r10taxondetermination_specimen_id ON taxondetermination USING btree (specimen_id);


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

CREATE INDEX fki_specimen_collector_id ON specimen USING btree (collector_id);


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

CREATE INDEX fki_specimen_reference_id_fkey ON specimen USING btree (reference_id);


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

CREATE INDEX fki_taxonbin_sizeclass_id ON taxonbin USING btree (sizeclass_id);


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

CREATE INDEX fki_taxondetermination_individualplant_id ON taxondetermination USING btree (individualplant_id);


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

CREATE UNIQUE INDEX graphic_accessioncode_index ON graphic USING btree (accessioncode);


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

CREATE INDEX graphic_plotevent_id_x ON graphic USING btree (plotevent_id);


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

CREATE INDEX individualplant_aggregateoccurrence_id_x ON individualplant USING btree (aggregateoccurrence_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: 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: 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: place_namedplace_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX place_namedplace_id_x ON place USING btree (namedplace_id);


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

CREATE INDEX place_plot_id_x ON place USING btree (plot_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_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: plot_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX plot_accessioncode_index ON plot USING btree (accessioncode);


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

CREATE INDEX plot_parent_id_x ON plot USING btree (parent_id);


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

CREATE INDEX plot_reference_id_x ON plot USING btree (reference_id);


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

CREATE UNIQUE INDEX plotevent_accessioncode_index ON plotevent USING btree (accessioncode);


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

CREATE INDEX plotevent_covermethod_id_x ON plotevent USING btree (covermethod_id);


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

CREATE INDEX plotevent_plot_id_x ON plotevent USING btree (plot_id);


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

CREATE INDEX plotevent_previousobs_id_x ON plotevent USING btree (previous_id);


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

CREATE INDEX plotevent_project_id_x ON plotevent USING btree (project_id);


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

CREATE INDEX plotevent_soiltaxon_id_x ON plotevent USING btree (soiltaxon_id);


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

CREATE INDEX plotevent_stratummethod_id_x ON plotevent USING btree (stratummethod_id);


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

CREATE INDEX ploteventcontributor_party_id_x ON ploteventcontributor USING btree (party_id);


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

CREATE INDEX ploteventcontributor_plotevent_id_x ON ploteventcontributor USING btree (plotevent_id);


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

CREATE INDEX ploteventcontributor_role_id_x ON ploteventcontributor USING btree (role_id);


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

CREATE UNIQUE INDEX ploteventsynonym_accessioncode_index ON ploteventsynonym USING btree (accessioncode);


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

CREATE INDEX ploteventsynonym_party_id_x ON ploteventsynonym USING btree (party_id);


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

CREATE INDEX ploteventsynonym_primaryplotevent_id_x ON ploteventsynonym USING btree (primaryplotevent_id);


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

CREATE INDEX ploteventsynonym_role_id_x ON ploteventsynonym USING btree (role_id);


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

CREATE INDEX ploteventsynonym_synonymplotevent_id_x ON ploteventsynonym USING btree (synonymplotevent_id);


--
-- 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: soilobs_plotevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX soilobs_plotevent_id_x ON soilobs USING btree (plotevent_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: stem_individualplant_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stem_individualplant_id_x ON stem USING btree (individualplant_id);


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

CREATE INDEX stratum_plotevent_id_x ON stratum USING btree (plotevent_id);


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

CREATE INDEX stratum_stratummethod_id_x ON stratum USING btree (stratummethod_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_museum_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_museum_id_x ON taxondetermination USING btree (museum_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_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_plantname_id_x ON taxondetermination USING btree (plantname_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_stem_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_stem_id_x ON taxondetermination USING btree (individualplant_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_int_currplantconcept_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_int_currplantconcept_id_x ON taxonoccurrence USING btree (int_currplantconcept_id);


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

CREATE INDEX taxonoccurrence_int_origplantconcept_id_x ON taxonoccurrence USING btree (int_origplantconcept_id);


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

CREATE INDEX taxonoccurrence_plotevent_id_x ON taxonoccurrence USING btree (plotevent_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: 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_taxonbin_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_taxonbin_id FOREIGN KEY (taxonbin_id) REFERENCES taxonbin(taxonbin_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 aux_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_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_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_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY disturbanceobs
    ADD CONSTRAINT disturbanceobs_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: embargo_plot_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY embargo
    ADD CONSTRAINT embargo_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: graphic_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY graphic
    ADD CONSTRAINT graphic_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: individualplant_aggregateoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY individualplant
    ADD CONSTRAINT individualplant_aggregateoccurrence_id FOREIGN KEY (aggregateoccurrence_id) REFERENCES aggregateoccurrence(aggregateoccurrence_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 aux_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 aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_namedplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_plot_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_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: 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: 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: plot_namedplace_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plot
    ADD CONSTRAINT plot_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plot_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plot
    ADD CONSTRAINT plot_parent_id FOREIGN KEY (parent_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plot_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plot
    ADD CONSTRAINT plot_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_covermethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_plot_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_previousobs_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_previousobs_id FOREIGN KEY (previous_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_project_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_soiltaxon_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plotevent_stratummethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plotevent
    ADD CONSTRAINT plotevent_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventcontributor_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventcontributor
    ADD CONSTRAINT ploteventcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventcontributor_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventcontributor
    ADD CONSTRAINT ploteventcontributor_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventcontributor_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventcontributor
    ADD CONSTRAINT ploteventcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventsynonym_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventsynonym
    ADD CONSTRAINT ploteventsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventsynonym_primaryplotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventsynonym
    ADD CONSTRAINT ploteventsynonym_primaryplotevent_id FOREIGN KEY (primaryplotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventsynonym_role_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventsynonym
    ADD CONSTRAINT ploteventsynonym_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: ploteventsynonym_synonymplotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY ploteventsynonym
    ADD CONSTRAINT ploteventsynonym_synonymplotevent_id FOREIGN KEY (synonymplotevent_id) REFERENCES plotevent(plotevent_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 aux_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_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY soilobs
    ADD CONSTRAINT soilobs_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_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: specimen_collector_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimen
    ADD CONSTRAINT specimen_collector_id FOREIGN KEY (collector_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimen_individualplant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimen
    ADD CONSTRAINT specimen_individualplant_id_fkey FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimen_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimen
    ADD CONSTRAINT specimen_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stem_individualplant_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stem
    ADD CONSTRAINT stem_individualplant_id FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_stratummethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_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: taxonbin_sizeclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonbin
    ADD CONSTRAINT taxonbin_sizeclass_id FOREIGN KEY (sizeclass_id) REFERENCES sizeclass(sizeclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_individualplant_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_individualplant_id FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_museum_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_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_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_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 aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_specimen_id FOREIGN KEY (specimen_id) REFERENCES specimen(specimen_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_plotevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_plotevent_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_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_stem_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY trait
    ADD CONSTRAINT trait_stem_id_fkey FOREIGN KEY (stem_id) REFERENCES stem(stem_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;


--
-- PostgreSQL database dump complete
--

