--
-- 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 text,
    email text,
    deliverypoint text,
    city text,
    administrativearea text,
    postalcode text,
    country text,
    currentflag boolean,
    addressstartdate timestamp with time zone
);


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

CREATE SEQUENCE address_address_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: aux_role; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

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


--
-- 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 MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    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,
    observation_id integer NOT NULL,
    inspection boolean,
    tableanalysis boolean,
    multivariateanalysis boolean,
    classpublication_id integer,
    classnotes text,
    commname text,
    commcode text,
    commframework text,
    commlevel text,
    classstartdate timestamp with time zone,
    classstopdate timestamp with time zone,
    emb_commclass integer,
    expertsystem text,
    accessioncode text
);


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

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


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

ALTER SEQUENCE commclass_commclass_id_seq OWNED BY commclass.commclass_id;


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

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


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

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


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

ALTER SEQUENCE commconcept_commconcept_id_seq OWNED BY commconcept.commconcept_id;


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

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


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

CREATE SEQUENCE commcorrelation_commcorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: comminterpretation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE comminterpretation (
    comminterpretation_id integer NOT NULL,
    commclass_id integer NOT NULL,
    commconcept_id integer,
    commcode text,
    commname text,
    classfit text,
    classconfidence text,
    commauthority_id integer,
    notes text,
    type boolean,
    nomenclaturaltype boolean,
    emb_comminterpretation integer
);


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

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


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

ALTER SEQUENCE comminterpretation_comminterpretation_id_seq OWNED BY comminterpretation.comminterpretation_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 MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    CACHE 1;


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

ALTER SEQUENCE commname_commname_id_seq OWNED BY commname.commname_id;


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

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


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

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


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

ALTER SEQUENCE commstatus_commstatus_id_seq OWNED BY commstatus.commstatus_id;


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

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


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

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


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

ALTER SEQUENCE commusage_commusage_id_seq OWNED BY commusage.commusage_id;


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

CREATE TABLE coverindex (
    coverindex_id integer NOT NULL,
    covermethod_id integer NOT NULL,
    covercode text NOT NULL,
    upperlimit double precision,
    lowerlimit double precision,
    coverpercent double precision NOT NULL,
    indexdescription text
);


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

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


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

ALTER SEQUENCE coverindex_coverindex_id_seq OWNED BY coverindex.coverindex_id;


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

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


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

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


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

ALTER SEQUENCE covermethod_covermethod_id_seq OWNED BY covermethod.covermethod_id;


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

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


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

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


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

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


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

ALTER SEQUENCE dba_cookie_cookie_id_seq OWNED BY dba_cookie.cookie_id;


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

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


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

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


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

ALTER SEQUENCE dba_cookielabels_cookielabel_id_seq OWNED BY dba_cookielabels.cookielabel_id;


SET default_with_oids = false;

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

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


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

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


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

ALTER SEQUENCE dba_datacache_dba_datacache_id_seq OWNED BY dba_datacache.dba_datacache_id;


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

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


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

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


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

ALTER SEQUENCE dba_datamodelversion_dba_datamodelversion_id_seq OWNED BY dba_datamodelversion.dba_datamodelversion_id;


SET default_with_oids = true;

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

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


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

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


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

ALTER SEQUENCE dba_dbstatstime_stat_id_seq OWNED BY dba_dbstatstime.stat_id;


SET default_with_oids = false;

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

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


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

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


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

ALTER SEQUENCE dba_fielddescription_dba_fielddescription_id_seq OWNED BY dba_fielddescription.dba_fielddescription_id;


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

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


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

CREATE SEQUENCE dba_fieldlist_dba_fieldlist_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    CACHE 1;


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

ALTER SEQUENCE dba_onerow_dba_onerow_id_seq OWNED BY dba_onerow.dba_onerow_id;


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

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


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

CREATE SEQUENCE dba_preassignacccode_dba_preassignacccode_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    CACHE 1;


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

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


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

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


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

ALTER SEQUENCE dba_tabledescription_dba_tabledescription_id_seq OWNED BY dba_tabledescription.dba_tabledescription_id;


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

CREATE TABLE dba_xmlcache (
    xml bytea,
    accessioncode text
);


SET default_with_oids = true;

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

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


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

CREATE SEQUENCE definedvalue_definedvalue_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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,
    observation_id integer NOT NULL,
    disturbancetype text NOT NULL,
    disturbanceintensity text,
    disturbanceage double precision,
    disturbanceextent double precision,
    disturbancecomment text,
    emb_disturbanceobs integer
);


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

CREATE SEQUENCE disturbanceobs_disturbanceobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    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,
    observation_id integer NOT NULL,
    graphicname text,
    graphiclocation text,
    graphicdescription text,
    graphictype text,
    graphicdata oid,
    graphicdate timestamp with time zone,
    accessioncode text
);


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

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


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

ALTER SEQUENCE graphic_graphic_id_seq OWNED BY graphic.graphic_id;


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

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


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

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


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

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


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

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


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

ALTER SEQUENCE namedplace_namedplace_id_seq OWNED BY namedplace.namedplace_id;


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

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


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

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


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

ALTER SEQUENCE namedplacecorrelation_namedplacecorrelation_id_seq OWNED BY namedplacecorrelation.namedplacecorrelation_id;


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

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


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

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


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

ALTER SEQUENCE note_note_id_seq OWNED BY note.note_id;


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

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


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

CREATE SEQUENCE notelink_notelink_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: observation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE observation (
    observation_id integer NOT NULL,
    previousobs_id integer,
    plot_id integer NOT NULL,
    project_id integer,
    authorobscode text,
    dateaccuracy text,
    covermethod_id integer,
    coverdispersion text,
    autotaxoncover boolean,
    stratummethod_id integer,
    methodnarrative text,
    taxonobservationarea double precision,
    stemsizelimit double precision,
    stemobservationarea double precision,
    stemsamplemethod text,
    originaldata text,
    effortlevel text,
    plotvalidationlevel integer,
    floristicquality text,
    bryophytequality text,
    lichenquality text,
    observationnarrative text,
    landscapenarrative text,
    homogeneity text,
    phenologicaspect text,
    representativeness text,
    standmaturity text,
    successionalstatus text,
    basalarea double precision,
    hydrologicregime text,
    soilmoistureregime text,
    soildrainage text,
    watersalinity text,
    waterdepth double precision,
    shoredistance double precision,
    soildepth double precision,
    organicdepth double precision,
    soiltaxon_id integer,
    soiltaxonsrc text,
    percentbedrock double precision,
    percentrockgravel double precision,
    percentwood double precision,
    percentlitter double precision,
    percentbaresoil double precision,
    percentwater double precision,
    percentother double precision,
    nameother text,
    treeht double precision,
    shrubht double precision,
    fieldht double precision,
    nonvascularht double precision,
    submergedht double precision,
    treecover double precision,
    shrubcover double precision,
    fieldcover double precision,
    nonvascularcover double precision,
    floatingcover double precision,
    submergedcover double precision,
    dominantstratum text,
    growthform1type text,
    growthform2type text,
    growthform3type text,
    growthform1cover double precision,
    growthform2cover double precision,
    growthform3cover double precision,
    totalcover double precision,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    obsstartdate timestamp with time zone,
    obsenddate timestamp with time zone,
    dateentered timestamp with time zone DEFAULT now(),
    emb_observation integer,
    interp_orig_ci_id integer,
    interp_orig_cc_id integer,
    interp_orig_sciname text,
    interp_orig_code text,
    interp_orig_party_id integer,
    interp_orig_partyname text,
    interp_current_ci_id integer,
    interp_current_cc_id integer,
    interp_current_sciname text,
    interp_current_code text,
    interp_current_party_id integer,
    interp_current_partyname text,
    interp_bestfit_ci_id integer,
    interp_bestfit_cc_id integer,
    interp_bestfit_sciname text,
    interp_bestfit_code text,
    interp_bestfit_party_id integer,
    interp_bestfit_partyname text,
    toptaxon1name text,
    toptaxon2name text,
    toptaxon3name text,
    toptaxon4name text,
    toptaxon5name text,
    numberoftaxa integer,
    accessioncode text
);


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

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


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

ALTER SEQUENCE observation_observation_id_seq OWNED BY observation.observation_id;


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

CREATE TABLE observationcontributor (
    observationcontributor_id integer NOT NULL,
    observation_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    contributiondate timestamp with time zone
);


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

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


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

ALTER SEQUENCE observationcontributor_observationcontributor_id_seq OWNED BY observationcontributor.observationcontributor_id;


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

CREATE TABLE observationsynonym (
    observationsynonym_id integer NOT NULL,
    synonymobservation_id integer NOT NULL,
    primaryobservation_id integer NOT NULL,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    synonymcomment text,
    classstartdate timestamp with time zone DEFAULT now() NOT NULL,
    classstopdate timestamp with time zone,
    accessioncode text
);


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

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


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

ALTER SEQUENCE observationsynonym_observationsynonym_id_seq OWNED BY observationsynonym.observationsynonym_id;


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

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


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

CREATE SEQUENCE party_party_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    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 text,
    plantcode text,
    plantdescription text,
    d_obscount integer,
    d_currentaccepted boolean,
    accessioncode text
);


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

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


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

ALTER SEQUENCE plantconcept_plantconcept_id_seq OWNED BY plantconcept.plantconcept_id;


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

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


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

CREATE SEQUENCE plantcorrelation_plantcorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    CACHE 1;


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

ALTER SEQUENCE plantlineage_plantlineage_id_seq OWNED BY plantlineage.plantlineage_id;


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

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


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

CREATE SEQUENCE plantname_plantname_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 text NOT NULL,
    plantpartycomments text,
    plantparentname text,
    plantparentconcept_id integer,
    plantparent_id integer,
    plantlevel text,
    party_id integer NOT NULL,
    startdate timestamp with time zone NOT NULL,
    stopdate timestamp with time zone,
    accessioncode text
);


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

CREATE SEQUENCE plantstatus_plantstatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 text,
    plantname text,
    classsystem text,
    acceptedsynonym text,
    party_id integer,
    plantstatus_id integer,
    usagestart timestamp with time zone,
    usagestop timestamp with time zone
);


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

CREATE SEQUENCE plantusage_plantusage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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,
    authorplotcode text NOT NULL,
    reference_id integer,
    parent_id integer,
    reallatitude double precision,
    reallongitude double precision,
    locationaccuracy double precision,
    confidentialitystatus integer NOT NULL,
    confidentialityreason text,
    latitude double precision,
    longitude double precision,
    authore text,
    authorn text,
    authorzone text,
    authordatum text,
    authorlocation text,
    locationnarrative text,
    azimuth double precision,
    dsgpoly text,
    shape text,
    area double precision,
    standsize text,
    placementmethod text,
    permanence boolean,
    layoutnarrative text,
    elevation double precision,
    elevationaccuracy double precision,
    elevationrange double precision,
    slopeaspect double precision,
    minslopeaspect double precision,
    maxslopeaspect double precision,
    slopegradient double precision,
    minslopegradient double precision,
    maxslopegradient double precision,
    topoposition text,
    landform text,
    surficialdeposits text,
    rocktype text,
    stateprovince text,
    country text,
    submitter_surname text,
    submitter_givenname text,
    submitter_email text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    dateentered timestamp with time zone DEFAULT now(),
    emb_plot integer,
    plotrationalenarrative text,
    accessioncode text
);


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

CREATE SEQUENCE plot_plot_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

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


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

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


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

ALTER SEQUENCE project_project_id_seq OWNED BY project.project_id;


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

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


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

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


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

ALTER SEQUENCE projectcontributor_projectcontributor_id_seq OWNED BY projectcontributor.projectcontributor_id;


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

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


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

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


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

ALTER SEQUENCE reference_reference_id_seq OWNED BY reference.reference_id;


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

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


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

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


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

ALTER SEQUENCE referencealtident_referencealtident_id_seq OWNED BY referencealtident.referencealtident_id;


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

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


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

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


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

ALTER SEQUENCE referencecontributor_referencecontributor_id_seq OWNED BY referencecontributor.referencecontributor_id;


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

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


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

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


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

ALTER SEQUENCE referencejournal_referencejournal_id_seq OWNED BY referencejournal.referencejournal_id;


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

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


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

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


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

ALTER SEQUENCE referenceparty_referenceparty_id_seq OWNED BY referenceparty.referenceparty_id;


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

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


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

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


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

ALTER SEQUENCE revision_revision_id_seq OWNED BY revision.revision_id;


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

CREATE TABLE soilobs (
    soilobs_id integer NOT NULL,
    observation_id integer NOT NULL,
    soilhorizon text NOT NULL,
    soildepthtop double precision,
    soildepthbottom double precision,
    soilcolor text,
    soilorganic double precision,
    soiltexture text,
    soilsand double precision,
    soilsilt double precision,
    soilclay double precision,
    soilcoarse double precision,
    soilph double precision,
    exchangecapacity double precision,
    basesaturation double precision,
    soildescription text,
    emb_soilobs integer
);


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

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


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

ALTER SEQUENCE soilobs_soilobs_id_seq OWNED BY soilobs.soilobs_id;


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

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


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

CREATE SEQUENCE soiltaxon_soiltaxon_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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;


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

CREATE TABLE stemcount (
    stemcount_id integer NOT NULL,
    taxonimportance_id integer NOT NULL,
    stemdiameter double precision,
    stemdiameteraccuracy double precision,
    stemheight double precision,
    stemheightaccuracy double precision,
    stemcount integer NOT NULL,
    stemtaxonarea double precision,
    emb_stemcount integer
);


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

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


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

ALTER SEQUENCE stemcount_stemcount_id_seq OWNED BY stemcount.stemcount_id;


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

CREATE TABLE stemlocation (
    stemlocation_id integer NOT NULL,
    stemcount_id integer NOT NULL,
    stemcode text,
    stemxposition double precision,
    stemyposition double precision,
    stemhealth text,
    emb_stemlocation integer
);


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

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


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

ALTER SEQUENCE stemlocation_stemlocation_id_seq OWNED BY stemlocation.stemlocation_id;


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

CREATE TABLE stratum (
    stratum_id integer NOT NULL,
    observation_id integer NOT NULL,
    stratumtype_id integer NOT NULL,
    stratummethod_id integer,
    stratumname text,
    stratumheight double precision,
    stratumbase double precision,
    stratumcover double precision,
    stratumdescription text
);


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

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


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

ALTER SEQUENCE stratum_stratum_id_seq OWNED BY stratum.stratum_id;


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

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


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

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


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

ALTER SEQUENCE stratummethod_stratummethod_id_seq OWNED BY stratummethod.stratummethod_id;


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

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


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

CREATE SEQUENCE stratumtype_stratumtype_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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,
    taxoninterpretation_id integer NOT NULL,
    plantconcept_id integer NOT NULL,
    taxonaltfit text,
    taxonaltconfidence text,
    taxonaltnotes text,
    emb_taxonalt integer
);


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

CREATE SEQUENCE taxonalt_taxonalt_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: taxonimportance; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonimportance (
    taxonimportance_id integer NOT NULL,
    taxonobservation_id integer NOT NULL,
    stratum_id integer,
    cover double precision,
    basalarea double precision,
    biomass double precision,
    inferencearea double precision,
    stratumbase double precision,
    stratumheight double precision,
    emb_taxonimportance integer,
    covercode text
);


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

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


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

ALTER SEQUENCE taxonimportance_taxonimportance_id_seq OWNED BY taxonimportance.taxonimportance_id;


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

CREATE TABLE taxoninterpretation (
    taxoninterpretation_id integer NOT NULL,
    taxonobservation_id integer NOT NULL,
    stemlocation_id integer,
    plantconcept_id integer NOT NULL,
    plantname_id integer,
    party_id integer NOT NULL,
    role_id integer NOT NULL,
    interpretationtype text,
    reference_id integer,
    originalinterpretation boolean NOT NULL,
    currentinterpretation boolean NOT NULL,
    taxonfit text,
    taxonconfidence text,
    collector_id integer,
    collectionnumber text,
    museum_id integer,
    museumaccessionnumber text,
    grouptype text,
    notes text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    interpretationdate timestamp with time zone NOT NULL,
    collectiondate timestamp with time zone,
    emb_taxoninterpretation integer,
    accessioncode text
);


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

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


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

ALTER SEQUENCE taxoninterpretation_taxoninterpretation_id_seq OWNED BY taxoninterpretation.taxoninterpretation_id;


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

CREATE TABLE taxonobservation (
    taxonobservation_id integer NOT NULL,
    observation_id integer NOT NULL,
    authorplantname text,
    reference_id integer,
    taxoninferencearea double precision,
    emb_taxonobservation integer,
    int_origplantconcept_id integer,
    int_origplantscifull text,
    int_origplantscinamenoauth text,
    int_origplantcommon text,
    int_origplantcode text,
    int_currplantconcept_id integer,
    int_currplantscifull text,
    int_currplantscinamenoauth text,
    int_currplantcommon text,
    int_currplantcode text,
    accessioncode text
);


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

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


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

ALTER SEQUENCE taxonobservation_taxonobservation_id_seq OWNED BY taxonobservation.taxonobservation_id;


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

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


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

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


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

ALTER SEQUENCE telephone_telephone_id_seq OWNED BY telephone.telephone_id;


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

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


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

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


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

ALTER SEQUENCE temptbl_std_commnames_commconcept_id_seq OWNED BY temptbl_std_commnames.commconcept_id;


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

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


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

CREATE SEQUENCE temptbl_std_plantnames_plantconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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;


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

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


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

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


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

ALTER SEQUENCE usercertification_usercertification_id_seq OWNED BY usercertification.usercertification_id;


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

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


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

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


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

ALTER SEQUENCE userdataset_userdataset_id_seq OWNED BY userdataset.userdataset_id;


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

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


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

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


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

ALTER SEQUENCE userdatasetitem_userdatasetitem_id_seq OWNED BY userdatasetitem.userdatasetitem_id;


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

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


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

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


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

ALTER SEQUENCE userdefined_userdefined_id_seq OWNED BY userdefined.userdefined_id;


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

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


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

CREATE SEQUENCE usernotify_usernotify_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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 MAXVALUE
    NO MINVALUE
    CACHE 1;


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

ALTER SEQUENCE userpermission_userpermission_id_seq OWNED BY userpermission.userpermission_id;


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

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


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

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


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

ALTER SEQUENCE userpreference_userpreference_id_seq OWNED BY userpreference.userpreference_id;


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

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


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

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


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

ALTER SEQUENCE userquery_userquery_id_seq OWNED BY userquery.userquery_id;


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

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


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

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


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

ALTER SEQUENCE userrecordowner_userrecordowner_id_seq OWNED BY userrecordowner.userrecordowner_id;


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

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


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

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


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

ALTER SEQUENCE userregionalexp_userregionalexp_id_seq OWNED BY userregionalexp.userregionalexp_id;


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

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


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

CREATE SEQUENCE usr_usr_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    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: view_all_commnames_code; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_commnames_code AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((commusage.classsystem)::text = 'Code'::text);


--
-- Name: view_all_commnames_common; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_commnames_common AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((commusage.classsystem)::text = 'Common'::text);


--
-- Name: view_all_commnames_sciname; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_commnames_sciname AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((commusage.classsystem)::text = 'Scientific'::text);


--
-- Name: view_all_commnames_translated; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_commnames_translated AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((commusage.classsystem)::text = 'Translated'::text);


--
-- Name: view_all_plantnames_code; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_plantnames_code AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((plantusage.classsystem)::text = 'Code'::text);


--
-- Name: view_all_plantnames_common; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_plantnames_common AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((plantusage.classsystem)::text = 'English Common'::text);


--
-- Name: view_all_plantnames_sciname; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_plantnames_sciname AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((plantusage.classsystem)::text = 'Scientific'::text);


--
-- Name: view_all_plantnames_scinamenoauth; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_all_plantnames_scinamenoauth AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((plantusage.classsystem)::text = 'Scientific without authors'::text);


--
-- Name: view_notemb_observation; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_observation AS
    SELECT observation.observation_id, observation.previousobs_id, observation.plot_id, observation.project_id, observation.authorobscode, observation.dateaccuracy, observation.covermethod_id, observation.coverdispersion, observation.autotaxoncover, observation.stratummethod_id, observation.methodnarrative, observation.taxonobservationarea, observation.stemsizelimit, observation.stemobservationarea, observation.stemsamplemethod, observation.originaldata, observation.effortlevel, observation.plotvalidationlevel, observation.floristicquality, observation.bryophytequality, observation.lichenquality, observation.observationnarrative, observation.landscapenarrative, observation.homogeneity, observation.phenologicaspect, observation.representativeness, observation.standmaturity, observation.successionalstatus, observation.basalarea, observation.hydrologicregime, observation.soilmoistureregime, observation.soildrainage, observation.watersalinity, observation.waterdepth, observation.shoredistance, observation.soildepth, observation.organicdepth, observation.soiltaxon_id, observation.soiltaxonsrc, observation.percentbedrock, observation.percentrockgravel, observation.percentwood, observation.percentlitter, observation.percentbaresoil, observation.percentwater, observation.percentother, observation.nameother, observation.treeht, observation.shrubht, observation.fieldht, observation.nonvascularht, observation.submergedht, observation.treecover, observation.shrubcover, observation.fieldcover, observation.nonvascularcover, observation.floatingcover, observation.submergedcover, observation.dominantstratum, observation.growthform1type, observation.growthform2type, observation.growthform3type, observation.growthform1cover, observation.growthform2cover, observation.growthform3cover, observation.totalcover, observation.notespublic, observation.notesmgt, observation.revisions, observation.obsstartdate, observation.obsenddate, observation.dateentered, observation.emb_observation, observation.interp_orig_ci_id, observation.interp_orig_cc_id, observation.interp_orig_sciname, observation.interp_orig_code, observation.interp_orig_party_id, observation.interp_orig_partyname, observation.interp_current_ci_id, observation.interp_current_cc_id, observation.interp_current_sciname, observation.interp_current_code, observation.interp_current_party_id, observation.interp_current_partyname, observation.interp_bestfit_ci_id, observation.interp_bestfit_cc_id, observation.interp_bestfit_sciname, observation.interp_bestfit_code, observation.interp_bestfit_party_id, observation.interp_bestfit_partyname, observation.toptaxon1name, observation.toptaxon2name, observation.toptaxon3name, observation.toptaxon4name, observation.toptaxon5name, observation.numberoftaxa, observation.accessioncode FROM observation WHERE (observation.emb_observation < 6);


--
-- Name: view_browseparty_classcontrib; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_classcontrib AS
    SELECT observation_2.observation_id, classcontributor.party_id FROM (view_notemb_observation observation_2 JOIN (commclass JOIN classcontributor ON ((commclass.commclass_id = classcontributor.commclass_id))) ON ((observation_2.observation_id = commclass.observation_id))) GROUP BY observation_2.observation_id, classcontributor.party_id;


--
-- Name: view_browseparty_obscontrib; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_obscontrib AS
    SELECT observationcontributor.party_id, observationcontributor.observation_id FROM (view_notemb_observation observation JOIN observationcontributor ON ((observation.observation_id = observationcontributor.observation_id))) GROUP BY observationcontributor.party_id, observationcontributor.observation_id;


--
-- Name: view_browseparty_projectcontrib; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_projectcontrib AS
    SELECT observation_1.observation_id, projectcontributor.party_id FROM ((project JOIN view_notemb_observation observation_1 ON ((project.project_id = observation_1.project_id))) JOIN projectcontributor ON ((project.project_id = projectcontributor.project_id))) GROUP BY observation_1.observation_id, projectcontributor.party_id;


--
-- Name: view_browseparty_all; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_all AS
    (SELECT view_browseparty_classcontrib.observation_id, view_browseparty_classcontrib.party_id FROM view_browseparty_classcontrib UNION SELECT view_browseparty_projectcontrib.observation_id, view_browseparty_projectcontrib.party_id FROM view_browseparty_projectcontrib) UNION SELECT view_browseparty_obscontrib.observation_id, view_browseparty_obscontrib.party_id FROM view_browseparty_obscontrib;


--
-- Name: view_browseparty_all_count; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_all_count AS
    SELECT count(1) AS countallcontrib, view_browseparty_all.party_id FROM view_browseparty_all GROUP BY view_browseparty_all.party_id;


--
-- Name: view_browseparty_classcontrib_count; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_classcontrib_count AS
    SELECT count(1) AS countclasscontrib, view_browseparty_classcontrib.party_id FROM view_browseparty_classcontrib GROUP BY view_browseparty_classcontrib.party_id;


--
-- Name: view_browseparty_obscontrib_count; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_obscontrib_count AS
    SELECT count(1) AS countobscontrib, view_browseparty_obscontrib.party_id FROM view_browseparty_obscontrib GROUP BY view_browseparty_obscontrib.party_id;


--
-- Name: view_browseparty_projectcontrib_count; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_projectcontrib_count AS
    SELECT count(1) AS countprojectcontrib, view_browseparty_projectcontrib.party_id FROM view_browseparty_projectcontrib GROUP BY view_browseparty_projectcontrib.party_id;


--
-- Name: view_browseparty_all_count_combined; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_browseparty_all_count_combined AS
    SELECT view_browseparty_all_count.party_id, view_browseparty_all_count.countallcontrib, view_browseparty_classcontrib_count.countclasscontrib, view_browseparty_obscontrib_count.countobscontrib, view_browseparty_projectcontrib_count.countprojectcontrib FROM (((view_browseparty_all_count LEFT JOIN view_browseparty_classcontrib_count ON ((view_browseparty_all_count.party_id = view_browseparty_classcontrib_count.party_id))) LEFT JOIN view_browseparty_obscontrib_count ON ((view_browseparty_all_count.party_id = view_browseparty_obscontrib_count.party_id))) LEFT JOIN view_browseparty_projectcontrib_count ON ((view_browseparty_all_count.party_id = view_browseparty_projectcontrib_count.party_id))) ORDER BY view_browseparty_all_count.countallcontrib DESC;


--
-- Name: view_busrule_duplcovercode; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_busrule_duplcovercode AS
    SELECT count(1) AS count, coverindex.covermethod_id, coverindex.covercode FROM coverindex GROUP BY coverindex.covermethod_id, coverindex.covercode HAVING (count(1) > 1);


--
-- Name: view_busrule_duplstratumtype; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_busrule_duplstratumtype AS
    SELECT count(1) AS count, stratumtype.stratummethod_id, stratumtype.stratumindex FROM stratumtype GROUP BY stratumtype.stratummethod_id, stratumtype.stratumindex HAVING (count(1) > 1);


--
-- Name: view_busrule_plotsizeshape; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_busrule_plotsizeshape AS
    SELECT observation.project_id, (SELECT project.projectname FROM project WHERE (project.project_id = observation.project_id)) AS projectname, count(1) AS plotcount FROM (plot JOIN observation ON ((plot.plot_id = observation.plot_id))) WHERE ((plot.area IS NULL) AND ((plot.shape IS NULL) OR (((plot.shape)::text <> 'Plotless'::text) AND (upper((plot.shape)::text) !~~ 'RELEV%'::text)))) GROUP BY observation.project_id;


--
-- Name: view_reference_transl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_reference_transl AS
    SELECT CASE WHEN (reference.shortname IS NULL) THEN CASE WHEN (reference.title IS NULL) THEN (CASE WHEN (reference.fulltext IS NULL) THEN '[poorly documented reference]'::text ELSE CASE WHEN (length(reference.fulltext) > 35) THEN (substr(reference.fulltext, 1, 32) || '...'::text) ELSE reference.fulltext END END)::text ELSE reference.title END ELSE reference.shortname END AS reference_id_transl, reference.reference_id FROM reference;


--
-- Name: view_commconcept_transl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_commconcept_transl AS
    SELECT commconcept.commconcept_id, commconcept.commname_id, commconcept.commname, commconcept.reference_id, (((commconcept.commname || ' ['::text) || ((SELECT view_reference_transl.reference_id_transl FROM view_reference_transl WHERE (view_reference_transl.reference_id = commconcept.reference_id)))::text) || ']'::text) AS commconcept_id_transl FROM commconcept;


--
-- Name: view_notemb_commclass; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_commclass AS
    SELECT commclass.commclass_id, commclass.observation_id, commclass.inspection, commclass.tableanalysis, commclass.multivariateanalysis, commclass.classpublication_id, commclass.classnotes, commclass.commname, commclass.commcode, commclass.commframework, commclass.commlevel, commclass.classstartdate, commclass.classstopdate, commclass.emb_commclass, commclass.expertsystem, commclass.accessioncode FROM commclass WHERE (commclass.emb_commclass < 6);


--
-- Name: view_comminterp_more; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_comminterp_more AS
    SELECT commclass.observation_id, commclass.inspection, commclass.tableanalysis, commclass.multivariateanalysis, commclass.expertsystem, commclass.classpublication_id, commclass.classnotes, commclass.accessioncode, commclass.classstartdate, commclass.classstopdate, comminterpretation.comminterpretation_id, comminterpretation.commclass_id, comminterpretation.commconcept_id, comminterpretation.commcode, comminterpretation.commname, comminterpretation.classfit, comminterpretation.classconfidence, comminterpretation.commauthority_id, comminterpretation.notes, comminterpretation.type, comminterpretation.nomenclaturaltype, comminterpretation.emb_comminterpretation, CASE WHEN ((comminterpretation.classfit)::text = 'Absolutely wrong'::text) THEN 6 WHEN ((comminterpretation.classfit)::text = 'Understandable but wrong'::text) THEN 4 WHEN ((comminterpretation.classfit)::text = 'Reasonable or acceptable answer'::text) THEN 3 WHEN ((comminterpretation.classfit)::text = 'Good answer'::text) THEN 2 WHEN ((comminterpretation.classfit)::text = 'Absolutely correct'::text) THEN 1 ELSE 5 END AS classfitnum, CASE WHEN ((comminterpretation.classconfidence)::text = 'High'::text) THEN 1 WHEN ((comminterpretation.classconfidence)::text = 'Medium'::text) THEN 2 WHEN ((comminterpretation.classconfidence)::text = 'Low'::text) THEN 3 ELSE 4 END AS classconfidencenum FROM view_notemb_commclass commclass, comminterpretation WHERE (commclass.commclass_id = comminterpretation.commclass_id);


--
-- Name: view_csv_taxonimportance_pre; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_csv_taxonimportance_pre AS
    SELECT taxonobservation.observation_id, taxonobservation.authorplantname AS plant, CASE WHEN (taxonimportance.stratum_id IS NULL) THEN '-all-'::text ELSE (SELECT stratumtype.stratumname FROM stratumtype, stratum WHERE ((stratum.stratumtype_id = stratumtype.stratumtype_id) AND (stratum.stratum_id = taxonimportance.stratum_id))) END AS stratum, taxonimportance.cover, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE (((coverindex.coverpercent = taxonimportance.cover) AND (coverindex.covermethod_id = observation.covermethod_id)) AND (observation.observation_id = taxonobservation.observation_id))) AS covercode_exact, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE ((((coverindex.upperlimit >= taxonimportance.cover) AND (coverindex.lowerlimit <= taxonimportance.cover)) AND (coverindex.covermethod_id = observation.covermethod_id)) AND (observation.observation_id = taxonobservation.observation_id))) AS covercode_byrange, taxonimportance.basalarea, taxonobservation.accessioncode FROM taxonobservation, taxonimportance, view_notemb_observation observation WHERE ((taxonobservation.taxonobservation_id = taxonimportance.taxonobservation_id) AND (taxonobservation.observation_id = observation.observation_id));


--
-- Name: view_csv_taxonimportance; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_csv_taxonimportance AS
    SELECT view_csv_taxonimportance_pre.observation_id, view_csv_taxonimportance_pre.plant, view_csv_taxonimportance_pre.stratum, view_csv_taxonimportance_pre.cover, CASE WHEN (view_csv_taxonimportance_pre.covercode_exact IS NULL) THEN view_csv_taxonimportance_pre.covercode_byrange ELSE view_csv_taxonimportance_pre.covercode_exact END AS covercode, view_csv_taxonimportance_pre.basalarea, view_csv_taxonimportance_pre.accessioncode FROM view_csv_taxonimportance_pre;


--
-- Name: view_dbafielddesc_notimpl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_dbafielddesc_notimpl AS
    SELECT dba_fielddescription.dba_fielddescription_id, dba_fielddescription.tablename, (SELECT dba_tabledescription.tablelabel FROM dba_tabledescription WHERE ((dba_fielddescription.tablename)::text = (dba_tabledescription.tablename)::text) LIMIT 1) AS tablename_transl, dba_fielddescription.fieldname, dba_fielddescription.fieldlabel, dba_fielddescription.fieldmodel, dba_fielddescription.fieldnulls, CASE WHEN ((dba_fielddescription.fieldnulls)::text = 'no'::text) THEN 'required'::text ELSE 'no'::text END AS fieldnulls_transl, dba_fielddescription.fieldtype, dba_fielddescription.fieldkey, CASE WHEN ((dba_fielddescription.fieldkey)::text = 'PK'::text) THEN dba_fielddescription.fieldkey WHEN ((dba_fielddescription.fieldkey)::text = 'FK'::text) THEN dba_fielddescription.fieldkey WHEN ((dba_fielddescription.fieldmodel)::text = 'denorm'::text) THEN dba_fielddescription.fieldmodel WHEN ((dba_fielddescription.fieldmodel)::text = 'implementation'::text) THEN dba_fielddescription.fieldmodel ELSE 'n/a'::text END AS fieldkey_transl, dba_fielddescription.fieldreferences, dba_fielddescription.fieldlist, dba_fielddescription.fieldnotes, dba_fielddescription.fielddefinition, dba_fielddescription.fieldkeywords FROM dba_fielddescription WHERE ((lower((dba_fielddescription.fieldmodel)::text) <> 'implementation'::text) AND (lower((dba_fielddescription.fieldmodel)::text) <> 'denorm'::text)) ORDER BY dba_fielddescription.dba_fielddescription_id;


--
-- Name: view_emb_embargo_currentfullonly; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_emb_embargo_currentfullonly AS
    SELECT embargo.embargo_id, embargo.plot_id, embargo.embargoreason, embargo.defaultstatus, embargo.embargostart, embargo.embargostop FROM embargo WHERE (((embargo.defaultstatus = 6) AND (embargo.embargostart < now())) AND (embargo.embargostop > now()));


--
-- Name: view_emb_embargo_complete; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_emb_embargo_complete AS
    SELECT COALESCE(emb.defaultstatus, 0) AS currentemb, plot.plot_id FROM (plot LEFT JOIN view_emb_embargo_currentfullonly emb ON ((plot.plot_id = emb.plot_id)));


--
-- Name: view_keywprojplaces; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_keywprojplaces AS
    SELECT project.project_id, plot.stateprovince FROM plot, project, observation WHERE ((plot.plot_id = observation.plot_id) AND (project.project_id = observation.project_id)) GROUP BY project.project_id, plot.stateprovince;


--
-- Name: view_kwhelper_projcontrib; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_kwhelper_projcontrib AS
    SELECT project.project_id, concat((((' '::text || (COALESCE(party.givenname, ''::text))::text) || ' '::text) || (COALESCE(party.surname, ''::text))::text)) AS kw FROM party, project, projectcontributor WHERE ((party.party_id = projectcontributor.party_id) AND (project.project_id = projectcontributor.project_id)) GROUP BY project.project_id;


--
-- Name: view_kwhelper_refjournal; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_kwhelper_refjournal AS
    SELECT reference.reference_id, (((((COALESCE(referencejournal.journal, ''::text))::text || ' '::text) || (COALESCE(referencejournal.issn, ''::text))::text) || ' '::text) || (COALESCE(referencejournal.abbreviation, ''::text))::text) AS kw FROM reference, referencejournal WHERE (reference.referencejournal_id = referencejournal.referencejournal_id) GROUP BY reference.reference_id, referencejournal.journal, referencejournal.issn, referencejournal.abbreviation;


--
-- Name: view_kwhelper_refparty; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_kwhelper_refparty AS
    SELECT reference.reference_id, concat((((((((' '::text || (COALESCE(referenceparty.givenname, ''::text))::text) || ' '::text) || (COALESCE(referenceparty.surname, ''::text))::text) || ' '::text) || (COALESCE(referenceparty.suffix, ''::text))::text) || ' '::text) || (COALESCE(referenceparty.organizationname, ''::text))::text)) AS kw FROM referenceparty, reference, referencecontributor WHERE ((referencecontributor.referenceparty_id = referenceparty.referenceparty_id) AND (reference.reference_id = referencecontributor.reference_id)) GROUP BY reference.reference_id;


--
-- Name: view_notemb_classcontributor; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_classcontributor AS
    SELECT classcontributor.classcontributor_id, classcontributor.commclass_id, classcontributor.party_id, classcontributor.role_id, classcontributor.emb_classcontributor FROM classcontributor WHERE (classcontributor.emb_classcontributor < 6);


--
-- Name: view_notemb_comminterpretation; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_comminterpretation AS
    SELECT comminterpretation.comminterpretation_id, comminterpretation.commclass_id, comminterpretation.commconcept_id, comminterpretation.commcode, comminterpretation.commname, comminterpretation.classfit, comminterpretation.classconfidence, comminterpretation.commauthority_id, comminterpretation.notes, comminterpretation.type, comminterpretation.nomenclaturaltype, comminterpretation.emb_comminterpretation FROM comminterpretation WHERE (comminterpretation.emb_comminterpretation < 6);


--
-- Name: view_notemb_disturbanceobs; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_disturbanceobs AS
    SELECT disturbanceobs.disturbanceobs_id, disturbanceobs.observation_id, disturbanceobs.disturbancetype, disturbanceobs.disturbanceintensity, disturbanceobs.disturbanceage, disturbanceobs.disturbanceextent, disturbanceobs.disturbancecomment, disturbanceobs.emb_disturbanceobs FROM disturbanceobs WHERE (disturbanceobs.emb_disturbanceobs < 6);


--
-- Name: view_notemb_plot; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_plot AS
    SELECT plot.plot_id, plot.authorplotcode, plot.reference_id, plot.parent_id, plot.reallatitude, plot.reallongitude, plot.locationaccuracy, plot.confidentialitystatus, plot.confidentialityreason, plot.latitude, plot.longitude, plot.authore, plot.authorn, plot.authorzone, plot.authordatum, plot.authorlocation, plot.locationnarrative, plot.azimuth, plot.dsgpoly, plot.shape, plot.area, plot.standsize, plot.placementmethod, plot.permanence, plot.layoutnarrative, plot.elevation, plot.elevationaccuracy, plot.elevationrange, plot.slopeaspect, plot.minslopeaspect, plot.maxslopeaspect, plot.slopegradient, plot.minslopegradient, plot.maxslopegradient, plot.topoposition, plot.landform, plot.surficialdeposits, plot.rocktype, plot.stateprovince, plot.country, plot.submitter_surname, plot.submitter_givenname, plot.submitter_email, plot.notespublic, plot.notesmgt, plot.revisions, plot.dateentered, plot.emb_plot, plot.plotrationalenarrative, plot.accessioncode FROM plot WHERE (plot.emb_plot < 6);


--
-- Name: view_notemb_soilobs; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_soilobs AS
    SELECT soilobs.soilobs_id, soilobs.observation_id, soilobs.soilhorizon, soilobs.soildepthtop, soilobs.soildepthbottom, soilobs.soilcolor, soilobs.soilorganic, soilobs.soiltexture, soilobs.soilsand, soilobs.soilsilt, soilobs.soilclay, soilobs.soilcoarse, soilobs.soilph, soilobs.exchangecapacity, soilobs.basesaturation, soilobs.soildescription, soilobs.emb_soilobs FROM soilobs WHERE (soilobs.emb_soilobs < 6);


--
-- Name: view_notemb_stemcount; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_stemcount AS
    SELECT stemcount.stemcount_id, stemcount.taxonimportance_id, stemcount.stemdiameter, stemcount.stemdiameteraccuracy, stemcount.stemheight, stemcount.stemheightaccuracy, stemcount.stemcount, stemcount.stemtaxonarea, stemcount.emb_stemcount FROM stemcount WHERE (stemcount.emb_stemcount < 6);


--
-- Name: view_notemb_stemlocation; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_stemlocation AS
    SELECT stemlocation.stemlocation_id, stemlocation.stemcount_id, stemlocation.stemcode, stemlocation.stemxposition, stemlocation.stemyposition, stemlocation.stemhealth, stemlocation.emb_stemlocation FROM stemlocation WHERE (stemlocation.emb_stemlocation < 6);


--
-- Name: view_notemb_taxonalt; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_taxonalt AS
    SELECT taxonalt.taxonalt_id, taxonalt.taxoninterpretation_id, taxonalt.plantconcept_id, taxonalt.taxonaltfit, taxonalt.taxonaltconfidence, taxonalt.taxonaltnotes, taxonalt.emb_taxonalt FROM taxonalt WHERE (taxonalt.emb_taxonalt < 6);


--
-- Name: view_notemb_taxonimportance; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_taxonimportance AS
    SELECT taxonimportance.taxonimportance_id, taxonimportance.taxonobservation_id, taxonimportance.stratum_id, taxonimportance.cover, taxonimportance.basalarea, taxonimportance.biomass, taxonimportance.inferencearea, taxonimportance.stratumbase, taxonimportance.stratumheight, taxonimportance.emb_taxonimportance, taxonimportance.covercode FROM taxonimportance WHERE (taxonimportance.emb_taxonimportance < 6);


--
-- Name: view_notemb_taxoninterpretation; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_taxoninterpretation AS
    SELECT taxoninterpretation.taxoninterpretation_id, taxoninterpretation.taxonobservation_id, taxoninterpretation.stemlocation_id, taxoninterpretation.plantconcept_id, taxoninterpretation.plantname_id, taxoninterpretation.party_id, taxoninterpretation.role_id, taxoninterpretation.interpretationtype, taxoninterpretation.reference_id, taxoninterpretation.originalinterpretation, taxoninterpretation.currentinterpretation, taxoninterpretation.taxonfit, taxoninterpretation.taxonconfidence, taxoninterpretation.collector_id, taxoninterpretation.collectionnumber, taxoninterpretation.museum_id, taxoninterpretation.museumaccessionnumber, taxoninterpretation.grouptype, taxoninterpretation.notes, taxoninterpretation.notespublic, taxoninterpretation.notesmgt, taxoninterpretation.revisions, taxoninterpretation.interpretationdate, taxoninterpretation.collectiondate, taxoninterpretation.emb_taxoninterpretation, taxoninterpretation.accessioncode FROM taxoninterpretation WHERE (taxoninterpretation.emb_taxoninterpretation < 6);


--
-- Name: view_notemb_taxonobservation; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_notemb_taxonobservation AS
    SELECT taxonobservation.taxonobservation_id, taxonobservation.observation_id, taxonobservation.authorplantname, taxonobservation.reference_id, taxonobservation.taxoninferencearea, taxonobservation.emb_taxonobservation, taxonobservation.int_origplantconcept_id, taxonobservation.int_origplantscifull, taxonobservation.int_origplantscinamenoauth, taxonobservation.int_origplantcommon, taxonobservation.int_origplantcode, taxonobservation.int_currplantconcept_id, taxonobservation.int_currplantscifull, taxonobservation.int_currplantscinamenoauth, taxonobservation.int_currplantcommon, taxonobservation.int_currplantcode, taxonobservation.accessioncode FROM taxonobservation WHERE (taxonobservation.emb_taxonobservation < 6);


--
-- Name: view_observation_transl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_observation_transl AS
    SELECT observation.observation_id, COALESCE(observation.authorobscode, plot.authorplotcode) AS observation_id_transl FROM view_notemb_observation observation, plot WHERE (observation.plot_id = plot.plot_id);


--
-- Name: view_party_public; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_party_public AS
    SELECT party.party_id, party.accessioncode, party.salutation, party.surname, party.givenname, party.middlename, party.organizationname, party.contactinstructions, party.email FROM (party LEFT JOIN usr ON ((party.party_id = usr.party_id))) WHERE ((usr.usr_id IS NULL) OR (usr.permission_type > 1));


--
-- Name: view_party_transl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_party_transl AS
    SELECT CASE WHEN (party.surname IS NULL) THEN CASE WHEN (party.organizationname IS NULL) THEN '[poorly documented party]'::text ELSE ((party.organizationname)::text || ' (organization)'::text) END ELSE ((party.surname)::text || CASE WHEN (party.givenname IS NULL) THEN ''::text ELSE (', '::text || (COALESCE(party.givenname, ''::text))::text) END) END AS party_id_transl, party.party_id FROM party;


--
-- Name: view_plantconcept_transl; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_plantconcept_transl AS
    SELECT plantconcept.plantconcept_id, plantconcept.plantname_id, plantconcept.plantname, plantconcept.reference_id, ((((plantconcept.plantname)::text || ' ['::text) || ((SELECT view_reference_transl.reference_id_transl FROM view_reference_transl WHERE (view_reference_transl.reference_id = plantconcept.reference_id)))::text) || ']'::text) AS plantconcept_id_transl FROM plantconcept;


--
-- Name: view_plotall_withembargo; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_plotall_withembargo AS
    SELECT plot.plot_id, plot.authorplotcode, plot.reference_id, plot.parent_id, plot.reallatitude, plot.reallongitude, plot.locationaccuracy, plot.confidentialitystatus, plot.confidentialityreason, plot.latitude, plot.longitude, plot.authore, plot.authorn, plot.authorzone, plot.authordatum, plot.authorlocation, plot.locationnarrative, plot.azimuth, plot.dsgpoly, plot.shape, plot.area, plot.standsize, plot.placementmethod, plot.permanence, plot.layoutnarrative, plot.elevation, plot.elevationaccuracy, plot.elevationrange, plot.slopeaspect, plot.minslopeaspect, plot.maxslopeaspect, plot.slopegradient, plot.minslopegradient, plot.maxslopegradient, plot.topoposition, plot.landform, plot.surficialdeposits, plot.rocktype, plot.stateprovince, plot.country, plot.submitter_surname, plot.submitter_givenname, plot.submitter_email, plot.notespublic, plot.notesmgt, plot.revisions, plot.dateentered, plot.emb_plot, plot.plotrationalenarrative, plot.accessioncode, embargo.embargo_id, embargo.embargoreason, embargo.defaultstatus, embargo.embargostart, embargo.embargostop, (embargo.defaultstatus + CASE WHEN (embargo.embargostop < now()) THEN 100 ELSE 0 END) AS embstatusinclexpired FROM (plot LEFT JOIN embargo ON ((plot.plot_id = embargo.plot_id)));


--
-- Name: view_std_commnames_code; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_commnames_code AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((((commusage.classsystem)::text = 'Code'::text) AND (commusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.512.NATURESERVE'::text)))) AND (commusage.usagestop IS NULL));


--
-- Name: view_std_commnames_common; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_commnames_common AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((((commusage.classsystem)::text = 'Common'::text) AND (commusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.512.NATURESERVE'::text)))) AND (commusage.usagestop IS NULL));


--
-- Name: view_std_commnames_sciname; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_commnames_sciname AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((((commusage.classsystem)::text = 'Scientific'::text) AND (commusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.512.NATURESERVE'::text)))) AND (commusage.usagestop IS NULL));


--
-- Name: view_std_commnames_translated; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_commnames_translated AS
    SELECT commusage.commconcept_id, commusage.commname FROM commusage WHERE ((((commusage.classsystem)::text = 'Translated'::text) AND (commusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.512.NATURESERVE'::text)))) AND (commusage.usagestop IS NULL));


--
-- Name: view_std_plantnames_code; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_plantnames_code AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((((plantusage.classsystem)::text = 'Code'::text) AND (plantusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.511.USDANRCSPLANTS2'::text)))) AND (plantusage.usagestop IS NULL));


--
-- Name: view_std_plantnames_common; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_plantnames_common AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((((plantusage.classsystem)::text = 'English Common'::text) AND (plantusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.511.USDANRCSPLANTS2'::text)))) AND (plantusage.usagestop IS NULL));


--
-- Name: view_std_plantnames_sciname; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_plantnames_sciname AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((((plantusage.classsystem)::text = 'Scientific'::text) AND (plantusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.511.USDANRCSPLANTS2'::text)))) AND (plantusage.usagestop IS NULL));


--
-- Name: view_std_plantnames_scinamenoauth; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_std_plantnames_scinamenoauth AS
    SELECT plantusage.plantconcept_id, plantusage.plantname FROM plantusage WHERE ((((plantusage.classsystem)::text = 'Scientific without authors'::text) AND (plantusage.party_id = (SELECT party.party_id FROM party WHERE ((party.accessioncode)::text = 'VB.Py.511.USDANRCSPLANTS2'::text)))) AND (plantusage.usagestop IS NULL));


--
-- Name: view_taxoninterp_more; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_taxoninterp_more AS
    SELECT taxoninterpretation.taxoninterpretation_id, taxoninterpretation.taxonobservation_id, taxoninterpretation.stemlocation_id, taxoninterpretation.plantconcept_id, taxoninterpretation.plantname_id, taxoninterpretation.party_id, taxoninterpretation.role_id, taxoninterpretation.interpretationtype, taxoninterpretation.reference_id, taxoninterpretation.originalinterpretation, taxoninterpretation.currentinterpretation, taxoninterpretation.taxonfit, taxoninterpretation.taxonconfidence, taxoninterpretation.collector_id, taxoninterpretation.collectionnumber, taxoninterpretation.museum_id, taxoninterpretation.museumaccessionnumber, taxoninterpretation.grouptype, taxoninterpretation.notes, taxoninterpretation.notespublic, taxoninterpretation.notesmgt, taxoninterpretation.revisions, taxoninterpretation.interpretationdate, taxoninterpretation.collectiondate, taxoninterpretation.emb_taxoninterpretation, taxoninterpretation.accessioncode, plantconcept.accessioncode AS pc_accessioncode, plantconcept.plantname AS pc_plantname, taxonobservation.observation_id FROM view_notemb_taxoninterpretation taxoninterpretation, taxonobservation, plantconcept WHERE ((taxonobservation.taxonobservation_id = taxoninterpretation.taxonobservation_id) AND (plantconcept.plantconcept_id = taxoninterpretation.plantconcept_id));


--
-- Name: view_taxonobs_withmaxcover; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_taxonobs_withmaxcover AS
    SELECT taxonobservation.taxonobservation_id, taxonobservation.observation_id, taxonobservation.authorplantname, taxonobservation.reference_id, taxonobservation.taxoninferencearea, taxonobservation.emb_taxonobservation, taxonobservation.int_origplantconcept_id, taxonobservation.int_origplantscifull, taxonobservation.int_origplantscinamenoauth, taxonobservation.int_origplantcommon, taxonobservation.int_origplantcode, taxonobservation.int_currplantconcept_id, taxonobservation.int_currplantscifull, taxonobservation.int_currplantscinamenoauth, taxonobservation.int_currplantcommon, taxonobservation.int_currplantcode, taxonobservation.accessioncode, (SELECT max(taxonimportance.cover) AS max FROM taxonimportance WHERE (taxonimportance.taxonobservation_id = taxonobservation.taxonobservation_id)) AS maxcover FROM view_notemb_taxonobservation taxonobservation;


--
-- Name: view_taxonobs_distinctid_curr; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_taxonobs_distinctid_curr AS
    SELECT userdatasetitem.userdataset_id, taxonobservation.observation_id, taxonobservation.int_currplantconcept_id AS plantconcept_id, max(taxonobservation.maxcover) AS maxplantcover FROM view_taxonobs_withmaxcover taxonobservation, userdatasetitem WHERE ((taxonobservation.observation_id = userdatasetitem.itemrecord) AND ((userdatasetitem.itemtable)::text = 'observation'::text)) GROUP BY taxonobservation.int_currplantconcept_id, userdatasetitem.userdataset_id, taxonobservation.observation_id;


--
-- Name: view_taxonobs_distinctid_curr_counts; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_taxonobs_distinctid_curr_counts AS
    SELECT view_taxonobs_distinctid_curr.userdataset_id, view_taxonobs_distinctid_curr.plantconcept_id, count(1) AS countobs, avg(view_taxonobs_distinctid_curr.maxplantcover) AS avgcovernoround, min(view_taxonobs_distinctid_curr.maxplantcover) AS mincovernoround, max(view_taxonobs_distinctid_curr.maxplantcover) AS maxcovernoround FROM view_taxonobs_distinctid_curr GROUP BY view_taxonobs_distinctid_curr.userdataset_id, view_taxonobs_distinctid_curr.plantconcept_id;


--
-- Name: view_taxonobs_distinctid_curr_counts_plants; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW view_taxonobs_distinctid_curr_counts_plants AS
    SELECT view_taxonobs_distinctid_curr_counts.userdataset_id, view_taxonobs_distinctid_curr_counts.plantconcept_id, view_taxonobs_distinctid_curr_counts.countobs, view_taxonobs_distinctid_curr_counts.avgcovernoround, view_taxonobs_distinctid_curr_counts.mincovernoround, view_taxonobs_distinctid_curr_counts.maxcovernoround, round((view_taxonobs_distinctid_curr_counts.avgcovernoround)::numeric, 3) AS avgcover, round((view_taxonobs_distinctid_curr_counts.mincovernoround)::numeric, 3) AS mincover, round((view_taxonobs_distinctid_curr_counts.maxcovernoround)::numeric, 3) AS maxcover, temptbl_std_plantnames.plantname, temptbl_std_plantnames.sciname, temptbl_std_plantnames.scinamenoauth, temptbl_std_plantnames.code, temptbl_std_plantnames.common FROM temptbl_std_plantnames, view_taxonobs_distinctid_curr_counts WHERE (view_taxonobs_distinctid_curr_counts.plantconcept_id = temptbl_std_plantnames.plantconcept_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: 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: comminterpretation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE comminterpretation ALTER COLUMN comminterpretation_id SET DEFAULT nextval('comminterpretation_comminterpretation_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: 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: observation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE observation ALTER COLUMN observation_id SET DEFAULT nextval('observation_observation_id_seq'::regclass);


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

ALTER TABLE observationcontributor ALTER COLUMN observationcontributor_id SET DEFAULT nextval('observationcontributor_observationcontributor_id_seq'::regclass);


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

ALTER TABLE observationsynonym ALTER COLUMN observationsynonym_id SET DEFAULT nextval('observationsynonym_observationsynonym_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: 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: 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: stemcount_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE stemcount ALTER COLUMN stemcount_id SET DEFAULT nextval('stemcount_stemcount_id_seq'::regclass);


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

ALTER TABLE stemlocation ALTER COLUMN stemlocation_id SET DEFAULT nextval('stemlocation_stemlocation_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: taxonimportance_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE taxonimportance ALTER COLUMN taxonimportance_id SET DEFAULT nextval('taxonimportance_taxonimportance_id_seq'::regclass);


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

ALTER TABLE taxoninterpretation ALTER COLUMN taxoninterpretation_id SET DEFAULT nextval('taxoninterpretation_taxoninterpretation_id_seq'::regclass);


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

ALTER TABLE taxonobservation ALTER COLUMN taxonobservation_id SET DEFAULT nextval('taxonobservation_taxonobservation_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: 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: 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_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_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: comminterpretation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY comminterpretation
    ADD CONSTRAINT comminterpretation_pkey PRIMARY KEY (comminterpretation_id);


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

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


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT observation_pkey PRIMARY KEY (observation_id);


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

ALTER TABLE ONLY observationcontributor
    ADD CONSTRAINT observationcontributor_pkey PRIMARY KEY (observationcontributor_id);


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

ALTER TABLE ONLY observationsynonym
    ADD CONSTRAINT observationsynonym_pkey PRIMARY KEY (observationsynonym_id);


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

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


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

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


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

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


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

ALTER TABLE ONLY stemcount
    ADD CONSTRAINT stemcount_pkey PRIMARY KEY (stemcount_id);


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

ALTER TABLE ONLY stemlocation
    ADD CONSTRAINT stemlocation_pkey PRIMARY KEY (stemlocation_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: taxonimportance_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonimportance
    ADD CONSTRAINT taxonimportance_pkey PRIMARY KEY (taxonimportance_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT taxoninterpretation_pkey PRIMARY KEY (taxoninterpretation_id);


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

ALTER TABLE ONLY taxonobservation
    ADD CONSTRAINT taxonobservation_pkey PRIMARY KEY (taxonobservation_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: 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: 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_observation_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commclass_observation_id_x ON commclass USING btree (observation_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: comminterpretation_commauthority_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX comminterpretation_commauthority_id_x ON comminterpretation USING btree (commauthority_id);


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

CREATE INDEX comminterpretation_commclass_id_x ON comminterpretation USING btree (commclass_id);


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

CREATE INDEX comminterpretation_commconcept_id_x ON comminterpretation 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_observation_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX disturbanceobs_observation_id_x ON disturbanceobs USING btree (observation_id);


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

CREATE INDEX emb_comminterpretation_idx ON comminterpretation USING btree (emb_comminterpretation);


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

CREATE INDEX emb_disturbanceobs_idx ON disturbanceobs USING btree (emb_disturbanceobs);


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

CREATE INDEX emb_observation_idx ON observation USING btree (emb_observation);


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

CREATE INDEX emb_plot_idx ON plot USING btree (emb_plot);


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

CREATE INDEX emb_soilobs_idx ON soilobs USING btree (emb_soilobs);


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

CREATE INDEX emb_stemcount_idx ON stemcount USING btree (emb_stemcount);


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

CREATE INDEX emb_stemlocation_idx ON stemlocation USING btree (emb_stemlocation);


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

CREATE INDEX emb_taxonalt_idx ON taxonalt USING btree (emb_taxonalt);


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

CREATE INDEX emb_taxonimportance_idx ON taxonimportance USING btree (emb_taxonimportance);


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

CREATE INDEX emb_taxoninterpretation_idx ON taxoninterpretation USING btree (emb_taxoninterpretation);


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

CREATE INDEX emb_taxonobservation_idx ON taxonobservation USING btree (emb_taxonobservation);


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

CREATE INDEX embargo_plot_id_x ON embargo USING btree (plot_id);


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

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


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

CREATE INDEX graphic_observation_id_x ON graphic USING btree (observation_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: observation_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX observation_accessioncode_index ON observation USING btree (accessioncode);


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

CREATE INDEX observation_covermethod_id_x ON observation USING btree (covermethod_id);


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

CREATE INDEX observation_plot_id_x ON observation USING btree (plot_id);


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

CREATE INDEX observation_previousobs_id_x ON observation USING btree (previousobs_id);


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

CREATE INDEX observation_project_id_x ON observation USING btree (project_id);


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

CREATE INDEX observation_soiltaxon_id_x ON observation USING btree (soiltaxon_id);


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

CREATE INDEX observation_stratummethod_id_x ON observation USING btree (stratummethod_id);


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

CREATE INDEX observationcontributor_observation_id_x ON observationcontributor USING btree (observation_id);


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

CREATE INDEX observationcontributor_party_id_x ON observationcontributor USING btree (party_id);


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

CREATE INDEX observationcontributor_role_id_x ON observationcontributor USING btree (role_id);


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

CREATE UNIQUE INDEX observationsynonym_accessioncode_index ON observationsynonym USING btree (accessioncode);


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

CREATE INDEX observationsynonym_party_id_x ON observationsynonym USING btree (party_id);


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

CREATE INDEX observationsynonym_primaryobservation_id_x ON observationsynonym USING btree (primaryobservation_id);


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

CREATE INDEX observationsynonym_role_id_x ON observationsynonym USING btree (role_id);


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

CREATE INDEX observationsynonym_synonymobservation_id_x ON observationsynonym USING btree (synonymobservation_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: 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_observation_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX soilobs_observation_id_x ON soilobs USING btree (observation_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: stemcount_taxonimportance_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stemcount_taxonimportance_id_x ON stemcount USING btree (taxonimportance_id);


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

CREATE INDEX stemlocation_stemcount_id_x ON stemlocation USING btree (stemcount_id);


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

CREATE INDEX stratum_observation_id_x ON stratum USING btree (observation_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_taxoninterpretation_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonalt_taxoninterpretation_id_x ON taxonalt USING btree (taxoninterpretation_id);


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

CREATE INDEX taxonimportance_stratum_id_x ON taxonimportance USING btree (stratum_id);


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

CREATE INDEX taxonimportance_taxonobservation_id_x ON taxonimportance USING btree (taxonobservation_id);


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

CREATE UNIQUE INDEX taxoninterpretation_accessioncode_index ON taxoninterpretation USING btree (accessioncode);


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

CREATE INDEX taxoninterpretation_collector_id_x ON taxoninterpretation USING btree (collector_id);


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

CREATE INDEX taxoninterpretation_museum_id_x ON taxoninterpretation USING btree (museum_id);


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

CREATE INDEX taxoninterpretation_party_id_x ON taxoninterpretation USING btree (party_id);


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

CREATE INDEX taxoninterpretation_plantconcept_id_x ON taxoninterpretation USING btree (plantconcept_id);


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

CREATE INDEX taxoninterpretation_plantname_id_x ON taxoninterpretation USING btree (plantname_id);


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

CREATE INDEX taxoninterpretation_reference_id_x ON taxoninterpretation USING btree (reference_id);


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

CREATE INDEX taxoninterpretation_role_id_x ON taxoninterpretation USING btree (role_id);


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

CREATE INDEX taxoninterpretation_stemlocation_id_x ON taxoninterpretation USING btree (stemlocation_id);


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

CREATE INDEX taxoninterpretation_taxonobservation_id_x ON taxoninterpretation USING btree (taxonobservation_id);


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

CREATE UNIQUE INDEX taxonobservation_accessioncode_index ON taxonobservation USING btree (accessioncode);


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

CREATE INDEX taxonobservation_int_currplantconcept_id_x ON taxonobservation USING btree (int_currplantconcept_id);


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

CREATE INDEX taxonobservation_int_origplantconcept_id_x ON taxonobservation USING btree (int_origplantconcept_id);


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

CREATE INDEX taxonobservation_observation_id_x ON taxonobservation USING btree (observation_id);


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

CREATE INDEX taxonobservation_reference_id_x ON taxonobservation 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: r1address_party_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address
    ADD CONSTRAINT r1address_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT r1classcontributor_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id);


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

ALTER TABLE ONLY commclass
    ADD CONSTRAINT r1commclass_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT r1commconcept_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id);


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

ALTER TABLE ONLY commcorrelation
    ADD CONSTRAINT r1commcorrelation_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id);


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

ALTER TABLE ONLY comminterpretation
    ADD CONSTRAINT r1comminterpretation_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id);


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

ALTER TABLE ONLY commlineage
    ADD CONSTRAINT r1commlineage_parentcommstatus_id FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id);


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

ALTER TABLE ONLY commname
    ADD CONSTRAINT r1commname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT r1commstatus_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);


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

ALTER TABLE ONLY commusage
    ADD CONSTRAINT r1commusage_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id);


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

ALTER TABLE ONLY coverindex
    ADD CONSTRAINT r1coverindex_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id);


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

ALTER TABLE ONLY covermethod
    ADD CONSTRAINT r1covermethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY definedvalue
    ADD CONSTRAINT r1definedvalue_userdefined_id FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id);


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

ALTER TABLE ONLY disturbanceobs
    ADD CONSTRAINT r1disturbanceobs_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY embargo
    ADD CONSTRAINT r1embargo_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);


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

ALTER TABLE ONLY graphic
    ADD CONSTRAINT r1graphic_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY namedplace
    ADD CONSTRAINT r1namedplace_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY namedplacecorrelation
    ADD CONSTRAINT r1namedplacecorrelation_parentplace_id FOREIGN KEY (parentplace_id) REFERENCES namedplace(namedplace_id);


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

ALTER TABLE ONLY note
    ADD CONSTRAINT r1note_notelink_id FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r1observation_previousobs_id FOREIGN KEY (previousobs_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY observationcontributor
    ADD CONSTRAINT r1observationcontributor_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY observationsynonym
    ADD CONSTRAINT r1observationsynonym_synonymobservation_id FOREIGN KEY (synonymobservation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY party
    ADD CONSTRAINT r1party_currentname_id FOREIGN KEY (currentname_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY partymember
    ADD CONSTRAINT r1partymember_parentparty_id FOREIGN KEY (parentparty_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY place
    ADD CONSTRAINT r1place_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);


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

ALTER TABLE ONLY plantconcept
    ADD CONSTRAINT r1plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);


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

ALTER TABLE ONLY plantcorrelation
    ADD CONSTRAINT r1plantcorrelation_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id);


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

ALTER TABLE ONLY plantlineage
    ADD CONSTRAINT r1plantlineage_childplantstatus_id FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id);


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

ALTER TABLE ONLY plantname
    ADD CONSTRAINT r1plantname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT r1plantstatus_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY plantusage
    ADD CONSTRAINT r1plantusage_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);


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

ALTER TABLE ONLY plot
    ADD CONSTRAINT r1plot_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT r1projectcontributor_project_id FOREIGN KEY (project_id) REFERENCES project(project_id);


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

ALTER TABLE ONLY reference
    ADD CONSTRAINT r1reference_referencejournal_id FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id);


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

ALTER TABLE ONLY referencealtident
    ADD CONSTRAINT r1referencealtident_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY referencecontributor
    ADD CONSTRAINT r1referencecontributor_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY referenceparty
    ADD CONSTRAINT r1referenceparty_currentparty_id FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id);


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

ALTER TABLE ONLY revision
    ADD CONSTRAINT r1revision_previousrevision_id FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id);


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

ALTER TABLE ONLY soilobs
    ADD CONSTRAINT r1soilobs_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY soiltaxon
    ADD CONSTRAINT r1soiltaxon_soilparent_id FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id);


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

ALTER TABLE ONLY stemcount
    ADD CONSTRAINT r1stemcount_taxonimportance_id FOREIGN KEY (taxonimportance_id) REFERENCES taxonimportance(taxonimportance_id);


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

ALTER TABLE ONLY stemlocation
    ADD CONSTRAINT r1stemlocation_stemcount_id FOREIGN KEY (stemcount_id) REFERENCES stemcount(stemcount_id);


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

ALTER TABLE ONLY stratum
    ADD CONSTRAINT r1stratum_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY stratummethod
    ADD CONSTRAINT r1stratummethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY stratumtype
    ADD CONSTRAINT r1stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);


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

ALTER TABLE ONLY taxonalt
    ADD CONSTRAINT r1taxonalt_taxoninterpretation_id FOREIGN KEY (taxoninterpretation_id) REFERENCES taxoninterpretation(taxoninterpretation_id);


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

ALTER TABLE ONLY taxonimportance
    ADD CONSTRAINT r1taxonimportance_taxonobservation_id FOREIGN KEY (taxonobservation_id) REFERENCES taxonobservation(taxonobservation_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r1taxoninterpretation_taxonobservation_id FOREIGN KEY (taxonobservation_id) REFERENCES taxonobservation(taxonobservation_id);


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

ALTER TABLE ONLY taxonobservation
    ADD CONSTRAINT r1taxonobservation_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY telephone
    ADD CONSTRAINT r1telephone_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY usercertification
    ADD CONSTRAINT r1usercertification_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userdataset
    ADD CONSTRAINT r1userdataset_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userdatasetitem
    ADD CONSTRAINT r1userdatasetitem_userdataset_id FOREIGN KEY (userdataset_id) REFERENCES userdataset(userdataset_id);


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

ALTER TABLE ONLY usernotify
    ADD CONSTRAINT r1usernotify_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userpermission
    ADD CONSTRAINT r1userpermission_embargo_id FOREIGN KEY (embargo_id) REFERENCES embargo(embargo_id);


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

ALTER TABLE ONLY userpreference
    ADD CONSTRAINT r1userpreference_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userquery
    ADD CONSTRAINT r1userquery_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userrecordowner
    ADD CONSTRAINT r1userrecordowner_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY userregionalexp
    ADD CONSTRAINT r1userregionalexp_usercertification_id FOREIGN KEY (usercertification_id) REFERENCES usercertification(usercertification_id);


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

ALTER TABLE ONLY usr
    ADD CONSTRAINT r1usr_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY address
    ADD CONSTRAINT r2address_organization_id FOREIGN KEY (organization_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT r2classcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY commclass
    ADD CONSTRAINT r2commclass_classpublication_id FOREIGN KEY (classpublication_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT r2commconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY commcorrelation
    ADD CONSTRAINT r2commcorrelation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);


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

ALTER TABLE ONLY comminterpretation
    ADD CONSTRAINT r2comminterpretation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);


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

ALTER TABLE ONLY commlineage
    ADD CONSTRAINT r2commlineage_childcommstatus_id FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id);


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

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT r2commstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY commusage
    ADD CONSTRAINT r2commusage_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);


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

ALTER TABLE ONLY namedplacecorrelation
    ADD CONSTRAINT r2namedplacecorrelation_childplace_id FOREIGN KEY (childplace_id) REFERENCES namedplace(namedplace_id);


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

ALTER TABLE ONLY note
    ADD CONSTRAINT r2note_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r2observation_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);


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

ALTER TABLE ONLY observationcontributor
    ADD CONSTRAINT r2observationcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY observationsynonym
    ADD CONSTRAINT r2observationsynonym_primaryobservation_id FOREIGN KEY (primaryobservation_id) REFERENCES observation(observation_id);


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

ALTER TABLE ONLY partymember
    ADD CONSTRAINT r2partymember_childparty_id FOREIGN KEY (childparty_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY place
    ADD CONSTRAINT r2place_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id);


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

ALTER TABLE ONLY plantconcept
    ADD CONSTRAINT r2plantconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY plantcorrelation
    ADD CONSTRAINT r2plantcorrelation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY plantlineage
    ADD CONSTRAINT r2plantlineage_parentplantstatus_id FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id);


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

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT r2plantstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY plantusage
    ADD CONSTRAINT r2plantusage_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY plot
    ADD CONSTRAINT r2plot_parent_id FOREIGN KEY (parent_id) REFERENCES plot(plot_id);


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

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT r2projectcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY referencecontributor
    ADD CONSTRAINT r2referencecontributor_referenceparty_id FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id);


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

ALTER TABLE ONLY stratum
    ADD CONSTRAINT r2stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id);


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

ALTER TABLE ONLY taxonalt
    ADD CONSTRAINT r2taxonalt_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY taxonimportance
    ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r2taxoninterpretation_stemlocation_id FOREIGN KEY (stemlocation_id) REFERENCES stemlocation(stemlocation_id);


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

ALTER TABLE ONLY taxonobservation
    ADD CONSTRAINT r2taxonobservation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY userpermission
    ADD CONSTRAINT r2userpermission_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);


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

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT r3classcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY comminterpretation
    ADD CONSTRAINT r3comminterpretation_commauthority_id FOREIGN KEY (commauthority_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT r3commstatus_commparent_id FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id);


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

ALTER TABLE ONLY commusage
    ADD CONSTRAINT r3commusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY note
    ADD CONSTRAINT r3note_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r3observation_project_id FOREIGN KEY (project_id) REFERENCES project(project_id);


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

ALTER TABLE ONLY observationcontributor
    ADD CONSTRAINT r3observationcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY observationsynonym
    ADD CONSTRAINT r3observationsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY partymember
    ADD CONSTRAINT r3partymember_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT r3plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY plantusage
    ADD CONSTRAINT r3plantusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT r3projectcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY stratum
    ADD CONSTRAINT r3stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r3taxoninterpretation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);


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

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT r4commstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY commusage
    ADD CONSTRAINT r4commusage_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r4observation_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id);


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

ALTER TABLE ONLY observationsynonym
    ADD CONSTRAINT r4observationsynonym_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY plantstatus
    ADD CONSTRAINT r4plantstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY plantusage
    ADD CONSTRAINT r4plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r4taxoninterpretation_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r5observation_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r5taxoninterpretation_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY observation
    ADD CONSTRAINT r6observation_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r6taxoninterpretation_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r7taxoninterpretation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r8taxoninterpretation_collector_id FOREIGN KEY (collector_id) REFERENCES party(party_id);


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

ALTER TABLE ONLY taxoninterpretation
    ADD CONSTRAINT r9taxoninterpretation_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_id);


--
-- PostgreSQL database dump complete
--

