-- SQL Manager Lite for PostgreSQL 6.3.1.54838
-- ---------------------------------------
-- Host      : server3
-- Database  : BAW
-- Version   : PostgreSQL 9.5.3, compiled by Visual C++ build 1800, 64-bit



CREATE SCHEMA gwbase AUTHORIZATION gwbase;
SET check_function_bodies = false;
--
-- Definition for function getdate (OID = 40236) : 
--
SET search_path = public, pg_catalog;
CREATE FUNCTION public.getdate (
)
RETURNS timestamp with time zone
AS 
$body$select now()$body$
LANGUAGE sql
STABLE;
--
-- Structure for table app_config_ (OID = 39295) : 
--
SET search_path = gwbase, pg_catalog;
CREATE TABLE gwbase.app_config_ (
    id serial NOT NULL,
    module_id varchar(32),
    key varchar(32),
    valuei integer,
    valuef double precision,
    "values" text,
    key_ varchar(32),
    value_i integer,
    value_f double precision,
    value_s text,
    mandant_id integer
)
WITH (oids = false);
--
-- Structure for table gpd_abweichungen (OID = 39304) : 
--
CREATE TABLE gwbase.gpd_abweichungen (
    msid integer NOT NULL,
    recid integer NOT NULL,
    aw_bis double precision,
    aw_neigung double precision,
    aw_azimut double precision,
    aw_xw double precision,
    aw_yw double precision,
    aw_zw double precision,
    aw_datum timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_msstamm (OID = 39309) : 
--
CREATE TABLE gwbase.gwb_msstamm (
    id integer NOT NULL,
    kennnr varchar(30),
    kennnr2 varchar(20),
    bezeichnung varchar(50),
    rechtswert double precision,
    hochwert double precision,
    xlabel double precision,
    ylabel double precision,
    hoehemp double precision,
    hoeheokg double precision,
    tk25 varchar(20),
    betreiber varchar(50),
    ort varchar(50),
    gemarkung varchar(50),
    flur varchar(20),
    flurstueck varchar(20),
    grundeigner varchar(50),
    lage varchar(100),
    baujahr char(4),
    beseitigt char(4),
    nachfolger varchar(20),
    vorgaenger varchar(20),
    art varchar(50),
    nutzung varchar(50),
    kat1 char(1) DEFAULT 'n'::bpchar,
    kat2 char(1) DEFAULT 'n'::bpchar,
    kat3 char(1) DEFAULT 'n'::bpchar,
    kat4 char(1) DEFAULT 'n'::bpchar,
    kat5 char(1) DEFAULT 'n'::bpchar,
    kat6 char(1) DEFAULT 'n'::bpchar,
    kat7 char(1) DEFAULT 'n'::bpchar,
    kat8 char(1) DEFAULT 'n'::bpchar,
    kat9 char(1) DEFAULT 'n'::bpchar,
    kat10 char(1) DEFAULT 'n'::bpchar,
    lageplandatei varchar(200),
    bilddatei varchar(200),
    bohrfirma varchar(50),
    bohrdurchmesser varchar(50),
    bohrverfahren varchar(50),
    bohrtiefe varchar(10),
    ausbaumaterial varchar(50),
    ausbaudurchm varchar(50),
    ausbautiefe varchar(10),
    filterstrecken varchar(250),
    filtertop double precision,
    filterbottom double precision,
    schlitzweite varchar(10),
    filterkies varchar(20),
    tonsperren varchar(50),
    ausbaudatei varchar(200),
    geology_id integer,
    gesteinsart varchar(50),
    kwert varchar(10),
    aquifer_id integer,
    aquifertop double precision,
    aquiferbase double precision,
    gwgespannt char(1) DEFAULT 'n'::bpchar,
    schichtendatei varchar(200),
    messintervallws integer,
    letztemessung timestamp without time zone,
    beprobintervall integer,
    letztebeprobung timestamp without time zone,
    wplan char(1) DEFAULT 'y'::bpchar,
    aplan char(1) DEFAULT 'y'::bpchar,
    uprogrammnr integer,
    statistikanfang timestamp without time zone,
    statistikende timestamp without time zone,
    nnmittel double precision,
    nnmax double precision,
    nnmin double precision,
    flurabstmittel double precision,
    flurabstmax double precision,
    flurabstmin double precision,
    datummin timestamp without time zone,
    datummax timestamp without time zone,
    symbol integer,
    qeinheit char(1),
    qart char(1),
    messpunkt varchar(25),
    toleranz double precision,
    extprog1name varchar(20),
    extprog1fileext char(3),
    extprog1path varchar(100),
    extprog1file varchar(200),
    extprog2name varchar(20),
    extprog2fileext char(3),
    extprog2path varchar(100),
    extprog2file varchar(200),
    messpunktbilddatei varchar(200),
    barcode varchar(20),
    entnahmeort char(1),
    rltg_l smallint,
    rltg_dm smallint,
    aufsatz_dm smallint,
    gla_nr varchar(30),
    datechange timestamp without time zone,
    anzahlfilter smallint,
    filterlaenge double precision,
    fassung_id integer,
    p_rep_id integer,
    negatelevels varchar(1),
    depthreference varchar(1),
    cnt_levels integer,
    cnt_samples integer,
    cnt_rates integer,
    cnt_files integer,
    utm_east double precision,
    utm_north double precision,
    visibletabs varchar(40),
    web_wellcat varchar(2),
    web_levelcat varchar(2),
    web_analycat varchar(2),
    web_ratecat varchar(2),
    web_levelstatcat varchar(2),
    web_analystatcat varchar(2),
    web_ratestatcat varchar(2),
    levelupperbound double precision,
    levellowerbound double precision,
    filterbottom_sl double precision,
    filtertop_sl double precision,
    absmaxlevel_sl double precision,
    avmaxlevel_sl double precision,
    absminlevel_sl double precision,
    avminlevel_sl double precision,
    avmeanlevel_sl double precision,
    seqno integer,
    datebuild timestamp without time zone,
    datedestroyed timestamp without time zone,
    drillelevation double precision,
    samplingdepth double precision,
    status_id integer,
    standardsamplingtype varchar(50),
    stationtype integer DEFAULT 1,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone,
    gwwlevels char(1) DEFAULT '-'::bpchar,
    gwwrates char(1) DEFAULT '-'::bpchar,
    gwwanalyses char(1) DEFAULT '-'::bpchar,
    gwwlogger char(1) DEFAULT '-'::bpchar,
    gwwrain char(1) DEFAULT '-'::bpchar,
    gwwclimate char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone,
    sap_key varchar(50),
    surfacewater_id integer,
    surfacewaterpart_id integer,
    km double precision,
    surfacewaterdistance double precision,
    catchmentarea_id integer,
    aquiferthickness varchar(20),
    filterlength double precision,
    streetkey varchar(20),
    houseno varchar(10),
    modifydate timestamp without time zone,
    groupno varchar(50),
    drilleddepth double precision
)
WITH (oids = false);
--
-- Structure for table gpd_msstamm (OID = 39338) : 
--
CREATE TABLE gwbase.gpd_msstamm (
    msid integer NOT NULL,
    stm_locid integer,
    stm_bohrid integer,
    stm_status integer,
    stm_vertraulichkeit integer,
    stm_bohrart integer,
    stm_bohrverf integer,
    stm_bohrzweck integer,
    stm_koordfind integer,
    stm_koordsys integer,
    stm_endrechtwert double precision,
    stm_endhochwert double precision,
    stm_bohransatzhoehe double precision,
    stm_bohrendhoehe double precision,
    stm_hfind integer,
    stm_hsys integer,
    stm_aktenzeichen varchar(64),
    stm_archivfach integer,
    stm_arnum integer,
    stm_tiefbarchivnr integer,
    stm_tk5 integer,
    stm_land integer,
    stm_bundesland integer,
    stm_landkreis integer,
    stm_regierungsbezirk integer,
    stm_behoerde integer,
    stm_auftraggeber integer,
    stm_frmbaustelle integer,
    stm_frmbohrung integer,
    stm_frmausbau integer,
    stm_frmkellerausbau integer,
    stm_betreuendesbuero integer,
    stm_dtmbohrbeginn timestamp without time zone,
    stm_dtmbohrende timestamp without time zone,
    stm_dtmbohrprot timestamp without time zone,
    stm_dtmdverfass timestamp without time zone,
    stm_dtmantrag timestamp without time zone,
    stm_dtmgenehmigung timestamp without time zone,
    stm_dtmbplatzeinrichten timestamp without time zone,
    stm_dtmbplatzraeumen timestamp without time zone,
    stm_dtmimport timestamp without time zone,
    stm_bearbeiterbohr integer,
    stm_bearbeitergeol integer,
    stm_bearbeiterhydro integer,
    stm_bohrmeister integer,
    stm_dverfasser varchar(80),
    stm_bauleiter integer,
    stm_dathinw varchar(48),
    stm_bemerkungen varchar(254),
    stm_hydaufschlussnr integer,
    stm_msart integer,
    stm_stratigrafieliste integer,
    stm_ptfileyn varchar(1),
    stm_issepimport varchar(1),
    stm_issep varchar(1),
    stm_sepvalid varchar(1),
    stm_oldwellid integer
)
WITH (oids = false);
--
-- Structure for table gpd_asbbohrloch (OID = 39346) : 
--
CREATE TABLE gwbase.gpd_asbbohrloch (
    msid integer NOT NULL,
    recid integer NOT NULL,
    abl_ok double precision,
    abl_uk double precision,
    abl_verfahren integer,
    abl_werkzeug integer,
    abl_durchmesser integer,
    abl_durchmzoll varchar(12),
    abl_notiz varchar(254)
)
WITH (oids = false);
--
-- Structure for table gpd_asbverrohrung (OID = 39351) : 
--
CREATE TABLE gwbase.gpd_asbverrohrung (
    msid integer NOT NULL,
    recid integer NOT NULL,
    aro_tourid integer,
    aro_ok double precision,
    aro_uk double precision,
    aro_typ integer,
    aro_material integer,
    aro_wandstaerke double precision,
    aro_bemerkung varchar(80),
    aro_durchmesser integer,
    aro_durchmzoll varchar(12),
    aro_displaypos integer,
    aro_ignorefilter varchar(1),
    aro_fueruebersicht varchar(1)
)
WITH (oids = false);
--
-- Structure for table gpd_asbfilter (OID = 39356) : 
--
CREATE TABLE gwbase.gpd_asbfilter (
    msid integer NOT NULL,
    afi_rohrrecid integer NOT NULL,
    afi_schlitzweite double precision,
    afi_pos integer,
    afi_hydgeoleinheit integer,
    afi_gwltyp integer,
    afi_hydraulik integer,
    afi_gwstockwerk integer,
    afi_bemerkung varchar(255)
)
WITH (oids = false);
--
-- Structure for table gpd_asbsonderbau (OID = 39361) : 
--
CREATE TABLE gwbase.gpd_asbsonderbau (
    msid integer NOT NULL,
    recid integer NOT NULL,
    ase_ok double precision,
    ase_uk double precision,
    ase_typ integer,
    ase_durchmesser integer,
    ase_wandstaerke double precision,
    ase_bemerkung varchar(80),
    ase_durchmzoll varchar(12)
)
WITH (oids = false);
--
-- Structure for table gpd_asbverfuellung (OID = 39366) : 
--
CREATE TABLE gwbase.gpd_asbverfuellung (
    msid integer NOT NULL,
    recid integer NOT NULL,
    avf_material integer,
    avf_ok double precision,
    avf_uk double precision,
    avf_durchmesser integer,
    avf_korngroessemin double precision,
    avf_korngroessemax double precision,
    avf_bemerkung varchar(80),
    avf_durchmzoll varchar(12),
    avf_teilverfuellung varchar(1)
)
WITH (oids = false);
--
-- Structure for table gpd_hydroparam (OID = 39371) : 
--
CREATE TABLE gwbase.gpd_hydroparam (
    msid integer NOT NULL,
    gwl double precision,
    t_rep double precision,
    t_sim double precision,
    kf_sim double precision,
    s_sim double precision,
    p_sim varchar(255),
    b_sim varchar(255),
    pv_lit varchar(50),
    t_lit double precision,
    kf_lit double precision,
    s_lit double precision,
    p_lit varchar(255),
    dquelle varchar(255),
    wsp_fis double precision,
    datum_fis timestamp without time zone,
    kf_fis double precision,
    t_fis double precision,
    b_fis varchar(255),
    s_fis double precision,
    e_fis double precision,
    t_logan double precision,
    e_logan double precision,
    q_log double precision,
    q_log2 double precision,
    s_log double precision,
    wsp_r_log double precision,
    wsp_a_log double precision,
    beharr_log varchar(50),
    b_log varchar(255)
)
WITH (oids = false);
--
-- Structure for table gpd_kluefte (OID = 39379) : 
--
CREATE TABLE gwbase.gpd_kluefte (
    msid integer NOT NULL,
    recid integer NOT NULL,
    kl_anfang double precision,
    kl_ende double precision,
    kl_neigung integer,
    kl_art integer,
    kl_bemerkung varchar(255)
)
WITH (oids = false);
--
-- Structure for table gpd_log (OID = 39384) : 
--
CREATE TABLE gwbase.gpd_log (
    msid integer NOT NULL,
    recid integer NOT NULL,
    lg_name varchar(40),
    lg_firma integer,
    lg_datum timestamp without time zone,
    lg_anfang double precision,
    lg_ende double precision,
    lg_bezug integer,
    lg_notitz varchar(254),
    lg_ergebnis varchar(254),
    lg_methode integer,
    lg_unit integer
)
WITH (oids = false);
--
-- Structure for table gpd_logdata (OID = 39392) : 
--
CREATE TABLE gwbase.gpd_logdata (
    msid integer NOT NULL,
    ld_logrecid integer NOT NULL,
    ld_recid integer NOT NULL,
    ld_datumzeit timestamp without time zone,
    ld_depth double precision,
    ld_value double precision,
    ld_unit integer
)
WITH (oids = false);
--
-- Structure for table gpd_mspassconfig (OID = 39397) : 
--
CREATE TABLE gwbase.gpd_mspassconfig (
    msid integer NOT NULL,
    config text
)
WITH (oids = false);
--
-- Structure for table gpd_mssynonyme (OID = 39405) : 
--
CREATE TABLE gwbase.gpd_mssynonyme (
    msid integer NOT NULL,
    mssyn_id integer NOT NULL,
    mssyn_synid integer,
    mssyn_bezeichnung varchar(128)
)
WITH (oids = false);
--
-- Structure for table gpd_packertest (OID = 39410) : 
--
CREATE TABLE gwbase.gpd_packertest (
    msid integer NOT NULL,
    recid integer NOT NULL,
    pt_testnr varchar(50),
    pt_datumzeit timestamp without time zone,
    pt_analysenansatz varchar(50),
    pt_intervallende double precision,
    pt_intervallanfang double precision,
    pt_streckenlaenge double precision,
    pt_zone integer,
    pt_bemerkung varchar(255),
    pt_art_t_kf integer,
    pt_t double precision,
    pt_t_zfgolder double precision,
    pt_kf double precision,
    pt_s double precision,
    pt_ss double precision,
    pt_elf double precision,
    pt_ph double precision,
    pt_intervallmittegok double precision,
    pt_ansatzhoehe double precision,
    pt_intervallmittenn double precision,
    pt_statischergwspiegelgok double precision,
    pt_statischergwspiegelnn double precision,
    pt_produziertesvolumen double precision,
    pt_geoleinhvon integer,
    pt_geoleinhbis integer,
    pt_geoleinhimporterr integer
)
WITH (oids = false);
--
-- Structure for table gpd_plfirma (OID = 39415) : 
--
CREATE TABLE gwbase.gpd_plfirma (
    plf_id integer NOT NULL,
    plf_listid integer,
    plf_name1 varchar(64),
    plf_name2 varchar(64),
    plf_plz varchar(10),
    plf_ort varchar(64),
    plf_strasse varchar(64),
    plf_telefon1 varchar(64),
    plf_telefon2 varchar(64),
    plf_fax1 varchar(64),
    plf_fax2 varchar(64),
    plf_email1 varchar(64),
    plf_email2 varchar(64),
    plf_typ integer,
    plf_land integer,
    plf_www varchar(255),
    plf_bemerkung varchar(255)
)
WITH (oids = false);
--
-- Structure for table gpd_plperson (OID = 39423) : 
--
CREATE TABLE gwbase.gpd_plperson (
    plp_id integer NOT NULL,
    plp_listid integer,
    plp_vorname varchar(64),
    plp_nachname varchar(64),
    plp_name varchar(128)
)
WITH (oids = false);
--
-- Structure for table gpd_plstandard (OID = 39428) : 
--
CREATE TABLE gwbase.gpd_plstandard (
    pls_id integer NOT NULL,
    pls_listid integer,
    pls_keysep varchar(12),
    pls_key varchar(12),
    pls_name varchar(255),
    pls_pttypeindex integer,
    pls_flag1 integer,
    pls_las varchar(12),
    pls_issep varchar(1)
)
WITH (oids = false);
--
-- Structure for table gpd_schichten (OID = 39433) : 
--
CREATE TABLE gwbase.gpd_schichten (
    msid integer NOT NULL,
    sd_layerid integer NOT NULL,
    sd_layercntr integer NOT NULL,
    sd_layerno integer,
    sd_sublayerno integer,
    sd_ok double precision,
    sd_uk double precision,
    sd_art varchar(128),
    sd_stratigrafie varchar(254),
    sd_stratigrafieid integer,
    sd_petrografie varchar(254),
    sd_genese varchar(254),
    sd_farbe varchar(254),
    sd_zusatz varchar(254),
    sd_bemerkung varchar(128),
    sd_beschaffenheitbohrgut varchar(128),
    sd_bohrvorgang varchar(128),
    sd_bodengruppe varchar(128),
    sd_kalkgehalt varchar(128),
    sd_intversion integer,
    sd_intgruppe varchar(12),
    sd_intklasse varchar(12),
    sd_intnotitz text,
    sd_textur integer,
    sd_kristallinitaet integer,
    sd_trennflaechenfuellung integer,
    sd_streichenfallen varchar(64),
    sd_ergbemerkung varchar(255),
    sd_ueblichebez varchar(64),
    sd_geolbez varchar(64),
    sd_bodenklasse integer,
    sd_verwitterung integer,
    sd_wetzones varchar(64),
    sd_fractures varchar(64),
    sd_petroklar varchar(255),
    sd_seppetro varchar(254),
    sd_sepfarbe varchar(254),
    sd_sepbeschbg varchar(128),
    sd_sepbeschbv varchar(128),
    sd_sepkalkgeh varchar(128),
    sd_stratigrafiekrz varchar(64),
    sd_artklar text,
    sd_geneseklar text,
    sd_farbeklar text,
    sd_zusatzklar text,
    sd_beschbgklar text,
    sd_bohrvorgangklar text,
    sd_bodengruppeklar text,
    sd_kalkgehaltklar text,
    sd_seperror integer
)
WITH (oids = false);
--
-- Structure for table gpd_schichttitel (OID = 39441) : 
--
CREATE TABLE gwbase.gpd_schichttitel (
    msid integer NOT NULL,
    recid integer NOT NULL,
    st_intversion integer,
    st_intprojleiter integer,
    st_intbearbeiter integer,
    st_dtmintbearbeitung timestamp without time zone,
    st_dtmintaenderung timestamp without time zone,
    st_uebernahmekennung varchar(50),
    st_opfeldbearbeiter varchar(64),
    st_ausw varchar(24),
    st_intgruppe varchar(12),
    st_intbasisversion integer,
    st_intneu integer,
    st_intbemerkung varchar(254)
)
WITH (oids = false);
--
-- Structure for table gpd_spuelung (OID = 39446) : 
--
CREATE TABLE gwbase.gpd_spuelung (
    msid integer NOT NULL,
    recid integer NOT NULL,
    sp_anfang double precision,
    sp_ende double precision,
    sp_art integer,
    sp_zusatz integer,
    sp_dichte double precision,
    sp_dichteeinh integer,
    sp_verhalten varchar(255),
    sp_menge double precision
)
WITH (oids = false);
--
-- Structure for table gpd_stratigraphie (OID = 39451) : 
--
CREATE TABLE gwbase.gpd_stratigraphie (
    strt_id integer NOT NULL,
    strt_parentid integer,
    strt_hierarchiestufe integer,
    strt_listid integer,
    strt_order integer,
    strt_kuerzel varchar(24),
    strt_kuerzeloffiziell varchar(24),
    strt_bezeichnung varchar(128),
    strt_bemerkung varchar(255),
    strt_lithologieid integer,
    strt_farbe integer,
    strt_importsynonyme varchar(255),
    strt_bereichdefjn varchar(1),
    strt_bereichvon integer,
    strt_bereichbis integer,
    strt_sepzs varchar(32),
    strt_issep varchar(1)
)
WITH (oids = false);
--
-- Structure for table gpd_stratlists (OID = 39459) : 
--
CREATE TABLE gwbase.gpd_stratlists (
    slst_id integer NOT NULL,
    slst_hierarchiebasis integer,
    slst_bezeichnung varchar(255),
    slst_profiltecfile varchar(255),
    slst_bemerkung varchar(255)
)
WITH (oids = false);
--
-- Structure for table gpd_synonymkat (OID = 39467) : 
--
CREATE TABLE gwbase.gpd_synonymkat (
    id integer NOT NULL,
    syn_sortierung integer,
    syn_name varchar(50),
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gpd_tempausbau (OID = 39473) : 
--
CREATE TABLE gwbase.gpd_tempausbau (
    msid integer NOT NULL,
    recid integer NOT NULL,
    taro_ok double precision,
    taro_uk double precision,
    taro_typ integer,
    taro_material integer,
    taro_durchmesser double precision,
    taro_wandstaerke double precision,
    taro_bemerkung varchar(254)
)
WITH (oids = false);
--
-- Structure for table gpd_tempschichten (OID = 39478) : 
--
CREATE TABLE gwbase.gpd_tempschichten (
    msid integer NOT NULL,
    recid integer NOT NULL,
    tsd_uk double precision,
    tsd_art varchar(128),
    tsd_stratigrafie varchar(254),
    tsd_petrografie varchar(254),
    tsd_bemerkung varchar(254)
)
WITH (oids = false);
--
-- Structure for table gpd_wasserrecht (OID = 39486) : 
--
CREATE TABLE gwbase.gpd_wasserrecht (
    msid integer NOT NULL,
    typ varchar(50),
    nr double precision,
    name varchar(50),
    wr1 varchar(255),
    wr2 varchar(255),
    wr3 varchar(255),
    nutzer varchar(50),
    qmax_a double precision,
    qmax double precision,
    qmax_h double precision,
    qmax_s double precision,
    qmit double precision,
    qmit_h double precision,
    bemerkung text,
    datenquelle varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_analymethods (OID = 39494) : 
--
CREATE TABLE gwbase.gwb_analymethods (
    id integer NOT NULL,
    methodname varchar(100),
    isold varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_analysen (OID = 39499) : 
--
CREATE TABLE gwbase.gwb_analysen (
    datumid integer NOT NULL,
    parameterid integer NOT NULL,
    messwert double precision,
    einheit varchar(10),
    zusatz char(1) DEFAULT '0'::bpchar,
    locked char(1) DEFAULT 'n'::bpchar,
    method_id integer,
    valuestdunit double precision,
    stdunit varchar(10),
    iscalculated varchar(1) DEFAULT 'n'::character varying,
    datatype integer DEFAULT 0
)
WITH (oids = false);
--
-- Structure for table gwb_berichte (OID = 39507) : 
--
CREATE TABLE gwbase.gwb_berichte (
    berichtsnr integer NOT NULL,
    titel1 varchar(50),
    titel2 varchar(50),
    titel3 varchar(50),
    titel4 varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_betreib (OID = 39512) : 
--
CREATE TABLE gwbase.gwb_betreib (
    betreiber varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_bohrfirm (OID = 39517) : 
--
CREATE TABLE gwbase.gwb_bohrfirm (
    bohrfirma varchar(50) NOT NULL,
    adresse1 varchar(50),
    adresse2 varchar(50),
    bemerkungen varchar(250),
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_bohrverf (OID = 39522) : 
--
CREATE TABLE gwbase.gwb_bohrverf (
    bohrverfahren varchar(50) NOT NULL,
    bemerkungen varchar(250),
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_buildingmaterialcat (OID = 39527) : 
--
CREATE TABLE gwbase.gwb_buildingmaterialcat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_changelogger (OID = 39534) : 
--
CREATE TABLE gwbase.gwb_changelogger (
    id serial NOT NULL,
    modifiedby varchar(20) NOT NULL,
    modifieddate timestamp without time zone NOT NULL,
    modifiedfields text,
    commandtype varchar(1),
    tablename varchar(50),
    tabledisplayname varchar(50),
    identifiertext varchar(50),
    identifierid integer
)
WITH (oids = false);
--
-- Structure for table gwb_checkrules (OID = 39543) : 
--
CREATE TABLE gwbase.gwb_checkrules (
    cr_wellid integer NOT NULL,
    cr_paramid integer NOT NULL,
    cr_ruletype smallint NOT NULL,
    cr_checkvalue double precision,
    cr_validfrom timestamp without time zone,
    cr_validuntil timestamp without time zone,
    cr_valuetype char(1) DEFAULT 'a'::bpchar,
    cr_valuedescr varchar(50),
    cr_active char(1) DEFAULT 'y'::bpchar,
    id integer
)
WITH (oids = false);
--
-- Structure for table gwb_checkrules_templates (OID = 39550) : 
--
CREATE TABLE gwbase.gwb_checkrules_templates (
    cr_templatename varchar(100),
    cr_paramid integer NOT NULL,
    cr_ruletype smallint NOT NULL,
    cr_checkvalue double precision,
    cr_validfrom timestamp without time zone,
    cr_validuntil timestamp without time zone,
    cr_valuetype char(1) DEFAULT 'a'::bpchar,
    cr_valuedescr varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_checkrules2 (OID = 39554) : 
--
CREATE TABLE gwbase.gwb_checkrules2 (
    cr_id integer NOT NULL,
    cr_wellid integer NOT NULL,
    cr_paramid integer NOT NULL,
    cr_ruletype integer NOT NULL,
    cr_checkvalue double precision,
    cr_valuedescr varchar(255),
    cr_active char(1) DEFAULT 'y'::bpchar,
    cr_samples smallint,
    cr_criticalsamples smallint,
    cr_lookaheadrange smallint,
    cr_lookaheadunit char(1),
    cr_lookbehindrange smallint,
    cr_lookbehindunit char(1)
)
WITH (oids = false);
--
-- Structure for table gwb_class_param (OID = 39560) : 
--
CREATE TABLE gwbase.gwb_class_param (
    param_id integer NOT NULL,
    class_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_dbversions (OID = 39565) : 
--
CREATE TABLE gwbase.gwb_dbversions (
    id integer NOT NULL,
    pidrill integer,
    pisqleditor integer,
    piweb integer
)
WITH (oids = false);
--
-- Structure for table gwb_dischargestatistic (OID = 39570) : 
--
CREATE TABLE gwbase.gwb_dischargestatistic (
    well_id integer NOT NULL,
    statyear integer,
    qsum_1 double precision,
    qsum_2 double precision,
    qsum_3 double precision,
    qsum_4 double precision,
    qsum_5 double precision,
    qsum_6 double precision,
    qsum_7 double precision,
    qsum_8 double precision,
    qsum_9 double precision,
    qsum_10 double precision,
    qsum_11 double precision,
    qsum_12 double precision,
    qsum_total double precision,
    qdailymax_1 double precision,
    qdatedailymax_1 timestamp without time zone,
    qdailymax_2 double precision,
    qdatedailymax_2 timestamp without time zone,
    qdailymax_3 double precision,
    qdatedailymax_3 timestamp without time zone,
    qdailymax_4 double precision,
    qdatedailymax_4 timestamp without time zone,
    qdailymax_5 double precision,
    qdatedailymax_5 timestamp without time zone,
    qdailymax_6 double precision,
    qdatedailymax_6 timestamp without time zone,
    qdailymax_7 double precision,
    qdatedailymax_7 timestamp without time zone,
    qdailymax_8 double precision,
    qdatedailymax_8 timestamp without time zone,
    qdailymax_9 double precision,
    qdatedailymax_9 timestamp without time zone,
    qdailymax_10 double precision,
    qdatedailymax_10 timestamp without time zone,
    qdailymax_11 double precision,
    qdatedailymax_11 timestamp without time zone,
    qdailymax_12 double precision,
    qdatedailymax_12 timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_doccategories (OID = 39573) : 
--
CREATE TABLE gwbase.gwb_doccategories (
    id integer NOT NULL,
    category varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_doctypes (OID = 39578) : 
--
CREATE TABLE gwbase.gwb_doctypes (
    id integer NOT NULL,
    doctype varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_einheit (OID = 39583) : 
--
CREATE TABLE gwbase.gwb_einheit (
    einheit varchar(10) NOT NULL,
    keynr varchar(10),
    unit_type integer
)
WITH (oids = false);
--
-- Structure for table gwb_elevationquality (OID = 39588) : 
--
CREATE TABLE gwbase.gwb_elevationquality (
    id integer NOT NULL,
    qualitytext varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_flowmeasurementcat (OID = 39593) : 
--
CREATE TABLE gwbase.gwb_flowmeasurementcat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_geologie (OID = 39598) : 
--
CREATE TABLE gwbase.gwb_geologie (
    id integer NOT NULL,
    geologischeeinheit varchar(50) NOT NULL,
    seqnr integer,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_geraete (OID = 39603) : 
--
CREATE TABLE gwbase.gwb_geraete (
    probennahmegeraet varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_graphics (OID = 39608) : 
--
CREATE TABLE gwbase.gwb_graphics (
    id integer NOT NULL,
    well_id integer,
    graphicfile varchar(255),
    filedescription varchar(255),
    filetype varchar(10),
    sortno integer,
    creator_id integer,
    user_id integer,
    project_id integer,
    doctype_id integer,
    category_id integer,
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone,
    displayname varchar(64),
    fileordir varchar(1) DEFAULT 'f'::character varying
)
WITH (oids = false);
--
-- Structure for table gwb_grenzen (OID = 39618) : 
--
CREATE TABLE gwbase.gwb_grenzen (
    xxmin double precision,
    xxmax double precision,
    ymin double precision,
    ymax double precision
)
WITH (oids = false);
--
-- Structure for table gwb_groups (OID = 39621) : 
--
CREATE TABLE gwbase.gwb_groups (
    g_id integer NOT NULL,
    p_id integer NOT NULL,
    g_type smallint,
    g_name varchar(50),
    g_xcoord double precision,
    g_ycoord double precision,
    po1_id integer,
    po2_id integer,
    po1_ref varchar(25),
    po2_ref varchar(25),
    g_comments text,
    datechange timestamp without time zone,
    proj_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_gwstockw (OID = 39629) : 
--
CREATE TABLE gwbase.gwb_gwstockw (
    id integer NOT NULL,
    grundwasserstockwerk varchar(50) NOT NULL,
    seqnr integer,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_hchange (OID = 39634) : 
--
CREATE TABLE gwbase.gwb_hchange (
    messtellenid integer NOT NULL,
    datumaenderung timestamp without time zone NOT NULL,
    neuehoehemp double precision,
    neuehoeheokg double precision,
    quality_id integer,
    comment varchar(100),
    filterbtm double precision
)
WITH (oids = false);
--
-- Structure for table gwb_imports (OID = 39639) : 
--
CREATE TABLE gwbase.gwb_imports (
    id integer NOT NULL,
    importdate timestamp without time zone,
    importedby varchar(30),
    fileordir varchar(255),
    nooffiles integer,
    importformat varchar(100)
)
WITH (oids = false);
--
-- Structure for table gwb_inoutletstructure (OID = 39642) : 
--
CREATE TABLE gwbase.gwb_inoutletstructure (
    object_id integer,
    length double precision,
    width double precision,
    height double precision,
    gaugewidth double precision,
    filterareasize double precision,
    commenttext text
)
WITH (oids = false);
--
-- Structure for table gwb_ionratios (OID = 39648) : 
--
CREATE TABLE gwbase.gwb_ionratios (
    date_id integer NOT NULL,
    mg_ca double precision,
    na_mg double precision,
    nak_cl double precision,
    cl_so4 double precision,
    cl_na double precision,
    camg_nak double precision,
    na_k double precision,
    cl_br double precision,
    hco3_clso4 double precision,
    k_ca double precision,
    done varchar(1) DEFAULT 'n'::character varying
)
WITH (oids = false);
--
-- Structure for table gwb_keyword_objects (OID = 39652) : 
--
CREATE TABLE gwbase.gwb_keyword_objects (
    keyword_id integer NOT NULL,
    object_id integer NOT NULL,
    object_type varchar(1) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_keywords (OID = 39657) : 
--
CREATE TABLE gwbase.gwb_keywords (
    id integer NOT NULL,
    keyword varchar(50) NOT NULL,
    category_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_labels (OID = 39662) : 
--
CREATE TABLE gwbase.gwb_labels (
    label_wellnr1 varchar(50),
    label_wellnr2 varchar(50),
    label_wellname varchar(50),
    label_map varchar(50),
    label_welltype varchar(50),
    label_wellusage varchar(50),
    label_wellcity varchar(50),
    label_welldistrict varchar(50),
    label_wellsubdistr varchar(50),
    label_wellsubdistrno varchar(50),
    label_position varchar(50),
    label_owner varchar(50),
    label_operatedby varchar(50),
    label_xcoord varchar(50),
    label_ycoord varchar(50),
    label_userfield1 varchar(50),
    label_userfield2 varchar(50),
    label_userfield3 varchar(50),
    label_userfield4 varchar(50),
    label_userfield5 varchar(50),
    label_projrefno1 varchar(50),
    label_projrefno2 varchar(50),
    label_projrefno3 varchar(50),
    label_projrefno4 varchar(50),
    label_projrefno5 varchar(50),
    label_projlogic1 varchar(50),
    label_projlogic2 varchar(50),
    label_projlogic3 varchar(50),
    label_projlogic4 varchar(50),
    label_projlogic5 varchar(50),
    label_projtext1 varchar(50),
    label_projtext2 varchar(50),
    label_projtext3 varchar(50),
    label_projtext4 varchar(50),
    label_projtext5 varchar(50),
    label_surfacewater varchar(50),
    label_surfacewaterpart varchar(50),
    label_surfacewaterkm varchar(50),
    label_sap_key varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_labors (OID = 39668) : 
--
CREATE TABLE gwbase.gwb_labors (
    id integer NOT NULL,
    labor varchar(100) NOT NULL,
    adresse1 varchar(50),
    adresse2 varchar(50),
    bemerkungen varchar(250),
    keynr varchar(10),
    relationfile varchar(255)
)
WITH (oids = false);
--
-- Structure for table gwb_level_attributes (OID = 39676) : 
--
CREATE TABLE gwbase.gwb_level_attributes (
    la_date_id integer NOT NULL,
    la_attribute_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_levelcomments (OID = 39681) : 
--
CREATE TABLE gwbase.gwb_levelcomments (
    commentid integer NOT NULL,
    commenttext varchar(50),
    keynr varchar(10),
    quality char(1) DEFAULT '+'::bpchar,
    todocategory_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_levelstatistic (OID = 39687) : 
--
CREATE TABLE gwbase.gwb_levelstatistic (
    well_id integer NOT NULL,
    statyear integer,
    maxlevel_sl double precision,
    minlevel_sl double precision,
    avlevel_sl double precision
)
WITH (oids = false);
--
-- Structure for table gwb_manhole (OID = 39690) : 
--
CREATE TABLE gwbase.gwb_manhole (
    object_id integer,
    geometrytype varchar(1),
    length double precision,
    width double precision,
    height double precision,
    material_id integer,
    accessgeometrytype varchar(1),
    accesslength double precision,
    accesswidth double precision,
    electrification varchar(1),
    remotecontrol varchar(1),
    commenttext text,
    totalheight double precision
)
WITH (oids = false);
--
-- Structure for table gwb_maps (OID = 39696) : 
--
CREATE TABLE gwbase.gwb_maps (
    mapfile varchar(255),
    mapcomment varchar(50) NOT NULL,
    xminmap double precision,
    xmaxmap double precision,
    yminmap double precision,
    ymaxmap double precision,
    contourmap char(1) DEFAULT 'n'::bpchar,
    selectmap char(1) DEFAULT 'n'::bpchar,
    digitizemap char(1) DEFAULT 'n'::bpchar,
    blankarea char(1) DEFAULT 'n'::bpchar,
    blitmode char(1) DEFAULT 'd'::bpchar,
    pixelsx integer,
    pixelsy integer,
    resolution integer,
    project_id integer,
    linecolor integer,
    linewidth integer,
    allwaysuse varchar(1),
    id integer,
    utm_east_minmap double precision,
    utm_north_minmap double precision,
    utm_east_maxmap double precision,
    utm_north_maxmap double precision,
    layerinfo text,
    mapuseoption integer
)
WITH (oids = false);
--
-- Structure for table gwb_maps_projects (OID = 39709) : 
--
CREATE TABLE gwbase.gwb_maps_projects (
    map_id integer NOT NULL,
    project_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_measdate (OID = 39714) : 
--
CREATE TABLE gwbase.gwb_measdate (
    id integer NOT NULL,
    logger char(1) DEFAULT '0'::bpchar,
    messtellenid integer,
    messdatum timestamp without time zone,
    progid integer,
    depth double precision,
    info varchar(2),
    import_id integer,
    depthrange integer,
    marker varchar(1) DEFAULT '+'::character varying
)
WITH (oids = false);
--
-- Structure for table gwb_memos (OID = 39721) : 
--
CREATE TABLE gwbase.gwb_memos (
    well_id integer NOT NULL,
    memotype integer NOT NULL,
    date_id integer NOT NULL,
    commenttext text
)
WITH (oids = false);
--
-- Structure for table gwb_miscstructure (OID = 39729) : 
--
CREATE TABLE gwbase.gwb_miscstructure (
    object_id integer,
    commenttext text
)
WITH (oids = false);
--
-- Structure for table gwb_msart (OID = 39735) : 
--
CREATE TABLE gwbase.gwb_msart (
    msart varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_nutzung (OID = 39740) : 
--
CREATE TABLE gwbase.gwb_nutzung (
    nutzung varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_object_pipes (OID = 39745) : 
--
CREATE TABLE gwbase.gwb_object_pipes (
    id integer NOT NULL,
    object_id integer NOT NULL,
    itemname varchar(50) NOT NULL,
    watertype_id integer,
    inputpipe_id integer,
    outputpipe_id integer,
    pipetype_id integer,
    elevation double precision,
    diameter integer,
    material_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_object_techparts (OID = 39750) : 
--
CREATE TABLE gwbase.gwb_object_techparts (
    id integer NOT NULL,
    object_id integer,
    part_id integer,
    commenttext varchar(255)
)
WITH (oids = false);
--
-- Structure for table gwb_objecttypes (OID = 39755) : 
--
CREATE TABLE gwbase.gwb_objecttypes (
    id integer NOT NULL,
    description varchar(100) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_organisation (OID = 39760) : 
--
CREATE TABLE gwbase.gwb_organisation (
    org_id integer NOT NULL,
    org_no integer,
    org_info varchar(50),
    org_name1 varchar(50),
    org_name2 varchar(50),
    org_name3 varchar(50),
    org_name4 varchar(50),
    org_zip1 varchar(10),
    org_street varchar(50),
    org_zip2 varchar(10),
    org_city varchar(50),
    org_tel varchar(25),
    org_fax varchar(25),
    org_email varchar(50),
    datechange timestamp without time zone,
    org_key varchar(20),
    org_pobox varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_paramet (OID = 39768) : 
--
CREATE TABLE gwbase.gwb_paramet (
    id integer NOT NULL,
    parameterkuerzel varchar(20),
    parametername varchar(100),
    standardeinheit varchar(10),
    standardunitsoil varchar(10),
    standarduniteluat varchar(10),
    keynr varchar(10),
    keynr2 varchar(10),
    paramtype integer,
    issumparam char(1) DEFAULT 'n'::bpchar,
    isonsiteparam char(1) DEFAULT 'n'::bpchar,
    molmasse double precision,
    color integer,
    kat1 char(1) DEFAULT 'n'::bpchar,
    kat2 char(1) DEFAULT 'n'::bpchar,
    kat3 char(1) DEFAULT 'n'::bpchar,
    kat4 char(1) DEFAULT 'n'::bpchar,
    kat5 char(1) DEFAULT 'n'::bpchar,
    kat6 char(1) DEFAULT 'n'::bpchar,
    kat7 char(1) DEFAULT 'n'::bpchar,
    kat8 char(1) DEFAULT 'n'::bpchar,
    kat9 char(1) DEFAULT 'n'::bpchar,
    kat10 char(1) DEFAULT 'n'::bpchar,
    bemerkungparameter varchar(250),
    allownegative char(1) DEFAULT 'n'::bpchar,
    grenzwert1 double precision,
    grenzwert1name varchar(50),
    grenzwert2 double precision,
    grenzwert2name varchar(50),
    grenzwert3 double precision,
    grenzwert3name varchar(50),
    grenzwert4 double precision,
    grenzwert4name varchar(50),
    grenzwert5 double precision,
    grenzwert5name varchar(50),
    grenzwert6 double precision,
    grenzwert6name varchar(50),
    grenzwert7 double precision,
    grenzwert7name varchar(50),
    grenzwert8 double precision,
    grenzwert8name varchar(50),
    stdgrenzwert char(1),
    seqnr integer,
    standardunitair varchar(10),
    lowerbound double precision,
    upperbound double precision,
    web_cat varchar(2),
    stdmethod_id integer,
    detectlimitwater double precision,
    detectlimitsoil double precision,
    detectlimitaqsol double precision,
    detectlimitair double precision,
    decimalplaces integer,
    valenceno integer,
    paramgroup varchar(1),
    symbol integer,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone,
    hasupperlimit char(1) DEFAULT '+'::bpchar
)
WITH (oids = false);
--
-- Structure for table gwb_paramlists (OID = 39791) : 
--
CREATE TABLE gwbase.gwb_paramlists (
    id integer NOT NULL,
    listname varchar(100),
    paramids text
)
WITH (oids = false);
--
-- Structure for table gwb_piconfig (OID = 39799) : 
--
CREATE TABLE gwbase.gwb_piconfig (
    piid integer NOT NULL,
    fieldname varchar(64) NOT NULL,
    vals varchar(255),
    vali integer,
    valf double precision,
    valdt timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_pipematerialcat (OID = 39804) : 
--
CREATE TABLE gwbase.gwb_pipematerialcat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_pipes (OID = 39809) : 
--
CREATE TABLE gwbase.gwb_pipes (
    id integer,
    pipename varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_pipetypecat (OID = 39812) : 
--
CREATE TABLE gwbase.gwb_pipetypecat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_proben (OID = 39817) : 
--
CREATE TABLE gwbase.gwb_proben (
    datumid integer NOT NULL,
    probennr varchar(20),
    probennehmer varchar(20),
    wetter varchar(50),
    labor varchar(100),
    entnahmetiefe double precision,
    entnahmetiefebis double precision,
    foerderrate varchar(10),
    foerderdauer varchar(10),
    foerdergeraet varchar(50),
    geraetetyp varchar(50),
    probenart varchar(50),
    truebung varchar(50),
    farbe varchar(50),
    geruch varchar(50),
    bodensatz varchar(50),
    uprogramm integer,
    programmeingegeben char(1) DEFAULT 'n'::bpchar,
    sampledescription varchar(100),
    levelbefore double precision,
    levelafter double precision,
    levelconst char(1),
    locked char(1) DEFAULT 'n'::bpchar,
    taste varchar(50),
    createdby integer,
    userfield1 varchar(50),
    userfield2 varchar(50),
    userfield3 varchar(50),
    userfield4 varchar(50),
    userfield5 varchar(50),
    reason_id integer,
    material_id integer,
    hardness varchar(50),
    sumcations double precision,
    sumanions double precision,
    sumcationsceq double precision,
    sumanionsceq double precision
)
WITH (oids = false);
--
-- Structure for table gwb_prog_param (OID = 39827) : 
--
CREATE TABLE gwbase.gwb_prog_param (
    prog_id integer NOT NULL,
    seqnr integer NOT NULL,
    param_id integer NOT NULL,
    detectlimit double precision,
    paramunit varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_proggroups (OID = 39832) : 
--
CREATE TABLE gwbase.gwb_proggroups (
    id integer NOT NULL,
    groupname varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_proggroups_progs (OID = 39837) : 
--
CREATE TABLE gwbase.gwb_proggroups_progs (
    group_id integer NOT NULL,
    prog_id integer NOT NULL,
    seqnr integer
)
WITH (oids = false);
--
-- Structure for table gwb_projects (OID = 39842) : 
--
CREATE TABLE gwbase.gwb_projects (
    id integer NOT NULL,
    projectdescr varchar(50),
    projectcomment varchar(50),
    referenceno_1 varchar(50),
    referenceno_2 varchar(50),
    referenceno_3 varchar(50),
    referenceno_4 varchar(50),
    referenceno_5 varchar(50),
    text_1 varchar(100),
    logical_1 varchar(1) DEFAULT 'n'::character varying,
    text_2 varchar(100),
    logical_2 varchar(1) DEFAULT 'n'::character varying,
    text_3 varchar(100),
    logical_3 varchar(1) DEFAULT 'n'::character varying,
    text_4 varchar(100),
    logical_4 varchar(1) DEFAULT 'n'::character varying,
    text_5 varchar(100),
    logical_5 varchar(1) DEFAULT 'n'::character varying,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone,
    owner_id integer,
    epsg_code varchar(20),
    nad_grid varchar(200),
    group_id integer,
    isdefaultgroup integer,
    stationsunique integer DEFAULT 0
)
WITH (oids = false);
--
-- Structure for table gwb_projects_users (OID = 39856) : 
--
CREATE TABLE gwbase.gwb_projects_users (
    pu_projectid integer NOT NULL,
    pu_loginname varchar(20) NOT NULL,
    pu_priv_wells smallint,
    pu_priv_level smallint,
    pu_priv_analysis smallint,
    pu_priv_discharge smallint,
    pu_priv_rainfall smallint
)
WITH (oids = false);
--
-- Structure for table gwb_projectsettings (OID = 39861) : 
--
CREATE TABLE gwbase.gwb_projectsettings (
    id integer,
    projectsettings text,
    lastopendate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_pump_data (OID = 39867) : 
--
CREATE TABLE gwbase.gwb_pump_data (
    id integer NOT NULL,
    well_id integer NOT NULL,
    equip_id integer NOT NULL,
    dateav timestamp without time zone,
    head_vol double precision,
    head_curr double precision,
    vol_curr double precision,
    datacount integer
)
WITH (oids = false);
--
-- Structure for table gwb_pumpen (OID = 39872) : 
--
CREATE TABLE gwbase.gwb_pumpen (
    pumpentyp varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_rainfall (OID = 39877) : 
--
CREATE TABLE gwbase.gwb_rainfall (
    well_id integer NOT NULL,
    date1 timestamp without time zone NOT NULL,
    date2 timestamp without time zone,
    rainfall double precision,
    import_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_rates (OID = 39882) : 
--
CREATE TABLE gwbase.gwb_rates (
    messtellenid integer NOT NULL,
    datum1 timestamp without time zone NOT NULL,
    datum2 timestamp without time zone,
    qwert double precision,
    ophours double precision,
    import_id integer,
    currentreading integer,
    commenttext varchar(50),
    valveposition double precision
)
WITH (oids = false);
--
-- Structure for table gwb_reportgroups (OID = 39887) : 
--
CREATE TABLE gwbase.gwb_reportgroups (
    id integer NOT NULL,
    groupname varchar(100) NOT NULL,
    title1 varchar(50),
    title2 varchar(50),
    title3 varchar(50),
    title4 varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_reportgroups_paramgroups (OID = 39892) : 
--
CREATE TABLE gwbase.gwb_reportgroups_paramgroups (
    group_id integer NOT NULL,
    paramgroup_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_reportgroups_params (OID = 39897) : 
--
CREATE TABLE gwbase.gwb_reportgroups_params (
    group_id integer NOT NULL,
    param_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_reportgroups_stations (OID = 39902) : 
--
CREATE TABLE gwbase.gwb_reportgroups_stations (
    group_id integer NOT NULL,
    station_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_reportgroups_templates (OID = 39907) : 
--
CREATE TABLE gwbase.gwb_reportgroups_templates (
    id integer NOT NULL,
    group_id integer NOT NULL,
    reporttemplate varchar(255) NOT NULL,
    seqno integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_samplecalendar (OID = 39912) : 
--
CREATE TABLE gwbase.gwb_samplecalendar (
    sampledate integer NOT NULL,
    well_id integer NOT NULL,
    proggroup_id integer NOT NULL,
    done varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_samplecolor (OID = 39917) : 
--
CREATE TABLE gwbase.gwb_samplecolor (
    color varchar(20) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_samplematerial (OID = 39922) : 
--
CREATE TABLE gwbase.gwb_samplematerial (
    id integer NOT NULL,
    shortname varchar(24),
    longname varchar(80)
)
WITH (oids = false);
--
-- Structure for table gwb_samples_progs (OID = 39927) : 
--
CREATE TABLE gwbase.gwb_samples_progs (
    sample_id integer NOT NULL,
    prog_id integer NOT NULL,
    seqnr integer
)
WITH (oids = false);
--
-- Structure for table gwb_samplesediment (OID = 39932) : 
--
CREATE TABLE gwbase.gwb_samplesediment (
    sediment varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_samplesmell (OID = 39937) : 
--
CREATE TABLE gwbase.gwb_samplesmell (
    smell varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_sampleturbidity (OID = 39942) : 
--
CREATE TABLE gwbase.gwb_sampleturbidity (
    turbidity varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_sampletype (OID = 39947) : 
--
CREATE TABLE gwbase.gwb_sampletype (
    sampletype varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_sampleweather (OID = 39952) : 
--
CREATE TABLE gwbase.gwb_sampleweather (
    weather varchar(50) NOT NULL,
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_samplingreasons (OID = 39957) : 
--
CREATE TABLE gwbase.gwb_samplingreasons (
    id integer NOT NULL,
    reason varchar(50),
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_selections (OID = 39962) : 
--
CREATE TABLE gwbase.gwb_selections (
    id integer NOT NULL,
    owner varchar(20),
    condname varchar(255),
    projcond varchar(255),
    wellcond text,
    progcond varchar(255)
)
WITH (oids = false);
--
-- Structure for table gwb_sensordepth (OID = 39970) : 
--
CREATE TABLE gwbase.gwb_sensordepth (
    id integer NOT NULL,
    well_id integer NOT NULL,
    sensordepth double precision NOT NULL,
    sensordate timestamp without time zone NOT NULL,
    commenttext varchar(100),
    mtype integer
)
WITH (oids = false);
--
-- Structure for table gwb_siteowners (OID = 39975) : 
--
CREATE TABLE gwbase.gwb_siteowners (
    id integer NOT NULL,
    name varchar(50),
    zip varchar(10),
    street varchar(50),
    town varchar(50),
    tel varchar(20)
)
WITH (oids = false);
--
-- Structure for table gwb_spec_yield (OID = 39980) : 
--
CREATE TABLE gwbase.gwb_spec_yield (
    id integer NOT NULL,
    well_id integer NOT NULL,
    mdate timestamp without time zone,
    drawdown double precision,
    flow double precision,
    commenttext varchar(50),
    mdate_static timestamp without time zone,
    static_level double precision,
    pressure double precision,
    power double precision
)
WITH (oids = false);
--
-- Structure for table gwb_sqlrecherche (OID = 39985) : 
--
CREATE TABLE gwbase.gwb_sqlrecherche (
    id integer NOT NULL,
    art varchar(1),
    bezeichnung varchar(64),
    beschreibung varchar(128),
    gruppe integer,
    kmsalle varchar(1),
    kmsteilgebiet integer,
    kmsroute integer,
    kmshwstockw integer,
    kmsgeoleinheit integer,
    kwswasserstandjn varchar(1),
    kwsperson integer,
    kwskennung varchar(1),
    kwsattribut integer,
    kwshinweisjn varchar(1),
    kwsmitohnewert varchar(1),
    kwsrelation varchar(1),
    kwswert double precision,
    kwsbezug varchar(1),
    kwswsunterfilteruk varchar(1),
    kwsgelotetetiefe varchar(1),
    kpbprobejn varchar(1),
    kpberledigtjn varchar(1),
    kpbprobennehmer varchar(64),
    kpbuprogramm integer,
    kayanalysejn varchar(1),
    kaymitparam varchar(1),
    kayparamanzahl varchar(1),
    kaymitohnewert varchar(1),
    kayparameter integer,
    kayrelation varchar(1),
    kaywert double precision,
    kaylabor integer,
    kdtdatumjn varchar(1),
    viscollage varchar(1),
    viscolanalymethod varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_stnflowdevicehistory (OID = 39990) : 
--
CREATE TABLE gwbase.gwb_stnflowdevicehistory (
    id integer NOT NULL,
    station_id integer NOT NULL,
    flowdevice_id integer NOT NULL,
    flowdevicedate timestamp without time zone NOT NULL,
    flowdevicecommenttext varchar(100)
)
WITH (oids = false);
--
-- Structure for table gwb_stoffkl (OID = 39995) : 
--
CREATE TABLE gwbase.gwb_stoffkl (
    class_id integer NOT NULL,
    name varchar(50),
    classtype integer,
    kat1 char(1) DEFAULT 'n'::bpchar,
    kat2 char(1) DEFAULT 'n'::bpchar,
    kat3 char(1) DEFAULT 'n'::bpchar,
    kat4 char(1) DEFAULT 'n'::bpchar,
    kat5 char(1) DEFAULT 'n'::bpchar,
    kat6 char(1) DEFAULT 'n'::bpchar,
    kat7 char(1) DEFAULT 'n'::bpchar,
    kat8 char(1) DEFAULT 'n'::bpchar,
    kat9 char(1) DEFAULT 'n'::bpchar,
    kat10 char(1) DEFAULT 'n'::bpchar,
    standardeinheit varchar(10),
    standardunitsoil varchar(10),
    standarduniteluat varchar(10),
    sumparam_id integer,
    color integer,
    sumcalconcomplete char(1) DEFAULT 'n'::bpchar,
    standardunitair varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_storedrivernet_aquifers (OID = 40011) : 
--
CREATE TABLE gwbase.gwb_storedrivernet_aquifers (
    storedrivernet_id integer NOT NULL,
    aquifer_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_storedrivernet_points (OID = 40016) : 
--
CREATE TABLE gwbase.gwb_storedrivernet_points (
    storedrivernet_id integer NOT NULL,
    seqnr integer NOT NULL,
    x double precision,
    y double precision,
    z double precision,
    connectiontype smallint,
    connectionfactor double precision
)
WITH (oids = false);
--
-- Structure for table gwb_storedrivernets (OID = 40021) : 
--
CREATE TABLE gwbase.gwb_storedrivernets (
    id integer NOT NULL,
    rivernetname varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_structparts (OID = 40026) : 
--
CREATE TABLE gwbase.gwb_structparts (
    id integer NOT NULL,
    struct_id integer,
    structpartname varchar(50),
    connectiontype smallint,
    connectionfactor double precision,
    elevationtop double precision,
    nextpart_id integer,
    prevpart_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_structparts_aquifers (OID = 40031) : 
--
CREATE TABLE gwbase.gwb_structparts_aquifers (
    structpart_id integer NOT NULL,
    aquifer_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_structparts_points (OID = 40036) : 
--
CREATE TABLE gwbase.gwb_structparts_points (
    structpart_id integer NOT NULL,
    point_id integer NOT NULL,
    nextpoint_id integer,
    prevpoint_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_structpoints (OID = 40041) : 
--
CREATE TABLE gwbase.gwb_structpoints (
    id integer NOT NULL,
    x double precision,
    y double precision,
    station_id integer
)
WITH (oids = false);
--
-- Structure for table gwb_structures (OID = 40046) : 
--
CREATE TABLE gwbase.gwb_structures (
    id integer NOT NULL,
    structname varchar(50),
    structtype char(1),
    priority smallint
)
WITH (oids = false);
--
-- Structure for table gwb_symbols (OID = 40051) : 
--
CREATE TABLE gwbase.gwb_symbols (
    symbolid integer NOT NULL,
    symbolchar char(1),
    symboltext varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_symbolscategories (OID = 40056) : 
--
CREATE TABLE gwbase.gwb_symbolscategories (
    id integer NOT NULL,
    field_name varchar(50) NOT NULL,
    category varchar(100),
    icon varchar(100),
    iconposition varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_taste (OID = 40061) : 
--
CREATE TABLE gwbase.gwb_taste (
    id integer NOT NULL,
    taste varchar(50),
    keynr varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_history (OID = 40066) : 
--
CREATE TABLE gwbase.gwb_techequip_history (
    id integer NOT NULL,
    equip_id integer NOT NULL,
    well_id integer NOT NULL,
    startdate timestamp without time zone,
    enddate timestamp without time zone,
    historytype char(1)
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_repairs (OID = 40071) : 
--
CREATE TABLE gwbase.gwb_techequip_repairs (
    id integer NOT NULL,
    equip_id integer NOT NULL,
    history_id integer NOT NULL,
    address varchar(255),
    person varchar(30),
    repairreason varchar(255),
    repaircosts double precision,
    remarks text
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_stores (OID = 40079) : 
--
CREATE TABLE gwbase.gwb_techequip_stores (
    id integer NOT NULL,
    equip_id integer NOT NULL,
    history_id integer NOT NULL,
    storeaddress varchar(255),
    remarks text
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_wells (OID = 40087) : 
--
CREATE TABLE gwbase.gwb_techequip_wells (
    id integer NOT NULL,
    equip_id integer NOT NULL,
    history_id integer NOT NULL,
    depth double precision,
    depthunit varchar(5),
    remarks text
)
WITH (oids = false);
--
-- Structure for table gwb_techequipment (OID = 40095) : 
--
CREATE TABLE gwbase.gwb_techequipment (
    id integer NOT NULL,
    category char(1),
    type varchar(50),
    person varchar(30),
    inventoryno varchar(50),
    material varchar(20),
    price double precision,
    dateaquired timestamp without time zone,
    manufacturer varchar(50),
    yearmade smallint,
    remarks text,
    datafile varchar(255),
    ratedflow double precision,
    ratedflowunit varchar(10),
    ratedcurrent double precision,
    ratedhead double precision,
    ratedheadunit varchar(5),
    diameter double precision,
    diameterunit varchar(5),
    length double precision,
    lengthunit varchar(5),
    systemlength double precision,
    systemlengthunit varchar(5),
    simcardno varchar(20),
    serialno varchar(50),
    inactive varchar(1) DEFAULT 'N'::character varying
)
WITH (oids = false);
--
-- Structure for table gwb_techpartscat (OID = 40103) : 
--
CREATE TABLE gwbase.gwb_techpartscat (
    id integer NOT NULL,
    class_id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_techpartsclasscat (OID = 40108) : 
--
CREATE TABLE gwbase.gwb_techpartsclasscat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_todocategories (OID = 40113) : 
--
CREATE TABLE gwbase.gwb_todocategories (
    id integer NOT NULL,
    categoryname varchar(50),
    sap_key varchar(50),
    repeatmonths integer
)
WITH (oids = false);
--
-- Structure for table gwb_topograf (OID = 40118) : 
--
CREATE TABLE gwbase.gwb_topograf (
    project_id integer NOT NULL,
    rechtswert double precision NOT NULL,
    hochwert double precision NOT NULL,
    hoehenn double precision
)
WITH (oids = false);
--
-- Structure for table gwb_ukat (OID = 40123) : 
--
CREATE TABLE gwbase.gwb_ukat (
    katalognr integer NOT NULL,
    katalogbezeichnung varchar(50),
    katalogtype integer,
    seqnr integer,
    lab_id integer,
    active varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_umrech (OID = 40128) : 
--
CREATE TABLE gwbase.gwb_umrech (
    einheit1 varchar(10) NOT NULL,
    einheit2 varchar(10) NOT NULL,
    faktor double precision
)
WITH (oids = false);
--
-- Structure for table gwb_users (OID = 40133) : 
--
CREATE TABLE gwbase.gwb_users (
    us_loginname varchar(20) NOT NULL,
    us_username varchar(30),
    us_password varchar(10),
    us_isadmin char(1) DEFAULT 'n'::bpchar,
    us_allowlookuplists char(1) DEFAULT 'y'::bpchar,
    us_allowwarnlist char(1) DEFAULT 'y'::bpchar,
    us_privatemaps char(1) DEFAULT 'y'::bpchar,
    us_lastuser char(1),
    us_tablelayoutchange varchar(1),
    id integer,
    us_loggerdata varchar(1),
    u_priv_wells integer,
    u_priv_level integer,
    u_priv_analysis integer,
    u_priv_discharge integer,
    u_priv_rainfall integer,
    us_privatesubprojects varchar(1),
    us_winusername varchar(255),
    templatedirectory varchar(255),
    us_passwordhash varchar(255),
    us_allprojects varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_userselection (OID = 40142) : 
--
CREATE TABLE gwbase.gwb_userselection (
    user_id integer NOT NULL,
    well_id integer NOT NULL,
    list_type integer
)
WITH (oids = false);
--
-- Structure for table gwb_valuemarkers (OID = 40145) : 
--
CREATE TABLE gwbase.gwb_valuemarkers (
    marker varchar(1) NOT NULL,
    markertext varchar(50),
    color integer,
    id serial NOT NULL,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone,
    hasflag char(1) DEFAULT '-'::bpchar,
    flagdefinition text,
    flagpreview bytea
)
WITH (oids = false);
--
-- Structure for table gwb_valveposition (OID = 40150) : 
--
CREATE TABLE gwbase.gwb_valveposition (
    id integer NOT NULL,
    valve_id integer NOT NULL,
    date_time timestamp without time zone,
    valveposition integer,
    maxvalveposition integer
)
WITH (oids = false);
--
-- Structure for table gwb_valves (OID = 40155) : 
--
CREATE TABLE gwbase.gwb_valves (
    id integer NOT NULL,
    object_id integer NOT NULL,
    elevation double precision,
    diameter integer,
    type_id integer,
    maxposition integer,
    description varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_valvetypecat (OID = 40160) : 
--
CREATE TABLE gwbase.gwb_valvetypecat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_version (OID = 40165) : 
--
CREATE TABLE gwbase.gwb_version (
    version varchar(10),
    version7 varchar(10),
    version8 varchar(10),
    backupdate timestamp without time zone,
    version9 varchar(10)
)
WITH (oids = false);
--
-- Structure for table gwb_virtualwells (OID = 40168) : 
--
CREATE TABLE gwbase.gwb_virtualwells (
    id integer NOT NULL,
    stationname varchar(20),
    referencestation_id integer NOT NULL,
    x double precision,
    y double precision,
    z double precision,
    timelag smallint,
    shift double precision,
    isabsolute char(1) DEFAULT 'n'::bpchar,
    isactive char(1) DEFAULT 'y'::bpchar,
    createdby varchar(20),
    comments varchar(255),
    symbol integer,
    utm_east double precision,
    utm_north double precision
)
WITH (oids = false);
--
-- Structure for table gwb_wasserrecht (OID = 40175) : 
--
CREATE TABLE gwbase.gwb_wasserrecht (
    id integer NOT NULL,
    zuord smallint,
    zuord_id integer,
    e_a integer,
    e_m integer,
    e_dm integer,
    e_dd integer,
    e_h integer,
    prob_int varchar(35),
    art smallint,
    anfang timestamp without time zone,
    ende timestamp without time zone,
    az1 varchar(25),
    az2 varchar(25),
    bemerk text,
    neben text,
    zweck varchar(30),
    dat_l_ae timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_waterquantity (OID = 40183) : 
--
CREATE TABLE gwbase.gwb_waterquantity (
    org_id integer NOT NULL,
    year smallint NOT NULL,
    groundwater double precision,
    sourcewater double precision,
    surfacewater double precision,
    externalwater double precision
)
WITH (oids = false);
--
-- Structure for table gwb_watertypecat (OID = 40188) : 
--
CREATE TABLE gwbase.gwb_watertypecat (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_wellgeology (OID = 40193) : 
--
CREATE TABLE gwbase.gwb_wellgeology (
    id integer NOT NULL,
    well_id integer,
    geology_id integer,
    depthtobase double precision,
    deeper varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_wellproperties (OID = 40198) : 
--
CREATE TABLE gwbase.gwb_wellproperties (
    id integer NOT NULL,
    property_name varchar(50) NOT NULL,
    property_key varchar(20),
    usecatalog integer
)
WITH (oids = false);
--
-- Structure for table gwb_wellproperties_wells (OID = 40203) : 
--
CREATE TABLE gwbase.gwb_wellproperties_wells (
    property_id integer NOT NULL,
    well_id integer NOT NULL,
    propertytext varchar(255),
    propertydate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_wellpumprates (OID = 40208) : 
--
CREATE TABLE gwbase.gwb_wellpumprates (
    id integer NOT NULL,
    well_id integer NOT NULL,
    startdate timestamp without time zone,
    enddate timestamp without time zone,
    pumprate double precision,
    pumpunit varchar(1)
)
WITH (oids = false);
--
-- Structure for table gwb_wells_projects (OID = 40213) : 
--
CREATE TABLE gwbase.gwb_wells_projects (
    well_id integer NOT NULL,
    project_id integer NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_wellstatuscat (OID = 40218) : 
--
CREATE TABLE gwbase.gwb_wellstatuscat (
    id integer NOT NULL,
    statusname varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_wellstatushistory (OID = 40223) : 
--
CREATE TABLE gwbase.gwb_wellstatushistory (
    id integer NOT NULL,
    well_id integer NOT NULL,
    status_id integer NOT NULL,
    statusdate timestamp without time zone NOT NULL,
    statuscommenttext varchar(100)
)
WITH (oids = false);
--
-- Structure for table gwb_welltodolist (OID = 40228) : 
--
CREATE TABLE gwbase.gwb_welltodolist (
    id integer NOT NULL,
    well_id integer,
    category_id integer,
    description varchar(255),
    createdate timestamp without time zone,
    todountil timestamp without time zone,
    user_id integer NOT NULL,
    donedate timestamp without time zone,
    donecomment varchar(255),
    doneuser_id integer,
    sap_notifynumber varchar(12),
    sap_ordernumber varchar(12),
    sap_status varchar(10),
    status integer
)
WITH (oids = false);
--
-- Structure for table gwb_welltodolistsap_err (OID = 40237) : 
--
CREATE TABLE gwbase.gwb_welltodolistsap_err (
    gwb_id integer NOT NULL,
    type varchar(1) NOT NULL,
    id varchar(20),
    number varchar(3),
    message varchar(220),
    log_no varchar(20),
    log_msg_no varchar(6),
    message_v1 varchar(50),
    message_v2 varchar(50),
    message_v3 varchar(50),
    message_v4 varchar(50),
    parameter varchar(32),
    "row" integer,
    field varchar(30),
    system varchar(10),
    message_date timestamp without time zone DEFAULT public.getdate()
)
WITH (oids = false);
--
-- Structure for table gwb_wstand (OID = 40244) : 
--
CREATE TABLE gwbase.gwb_wstand (
    id integer NOT NULL,
    messtellenid integer NOT NULL,
    datumzeit timestamp without time zone NOT NULL,
    wasserstand double precision,
    bezugmp char(1) DEFAULT 'y'::bpchar,
    quality char(1) DEFAULT '+'::bpchar,
    person_id integer,
    import_id integer,
    datatype integer DEFAULT 0,
    level_sl double precision,
    loggeddepth double precision,
    loggeddepth_sl double precision
)
WITH (oids = false);
--
-- Structure for table gwc_wellaquifers (OID = 40252) : 
--
CREATE TABLE gwbase.gwc_wellaquifers (
    id integer NOT NULL,
    orgid integer,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellcategories (OID = 40259) : 
--
CREATE TABLE gwbase.gwc_wellcategories (
    type_id integer NOT NULL,
    category_id integer NOT NULL,
    name varchar(128) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    symbolwidth integer,
    symbolheight integer,
    symbolanchorx integer DEFAULT 0,
    symbolanchory integer DEFAULT 0,
    symbolhotspot char(2) DEFAULT 'cc'::bpchar,
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellcategory_types (OID = 40269) : 
--
CREATE TABLE gwbase.gwc_wellcategory_types (
    id integer NOT NULL,
    tablename varchar(30),
    name varchar(50) NOT NULL,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellgeology (OID = 40275) : 
--
CREATE TABLE gwbase.gwc_wellgeology (
    id integer NOT NULL,
    orgid integer,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellgroundowner (OID = 40282) : 
--
CREATE TABLE gwbase.gwc_wellgroundowner (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellkind (OID = 40289) : 
--
CREATE TABLE gwbase.gwc_wellkind (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welllocation (OID = 40296) : 
--
CREATE TABLE gwbase.gwc_welllocation (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welllocationfl (OID = 40303) : 
--
CREATE TABLE gwbase.gwc_welllocationfl (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welllocationfs (OID = 40310) : 
--
CREATE TABLE gwbase.gwc_welllocationfs (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welllocationge (OID = 40317) : 
--
CREATE TABLE gwbase.gwc_welllocationge (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welloperator (OID = 40324) : 
--
CREATE TABLE gwbase.gwc_welloperator (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_wellsite (OID = 40331) : 
--
CREATE TABLE gwbase.gwc_wellsite (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwc_welluse (OID = 40338) : 
--
CREATE TABLE gwbase.gwc_welluse (
    id integer NOT NULL,
    name varchar(50) NOT NULL,
    seqnr integer DEFAULT 32000,
    symbolfilename varchar(32),
    symboldefinition varchar(128),
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwm_depths (OID = 40345) : 
--
CREATE TABLE gwbase.gwm_depths (
    well_id integer NOT NULL,
    depth double precision NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwm_persons (OID = 40350) : 
--
CREATE TABLE gwbase.gwm_persons (
    person_id integer NOT NULL,
    person_name varchar(20),
    person_pin varchar(4),
    allowseelastvalue char(1),
    allowmodifywelldata char(1),
    persontype varchar(1),
    sap_key varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwm_routes (OID = 40355) : 
--
CREATE TABLE gwbase.gwm_routes (
    route_id integer NOT NULL,
    route_name varchar(50),
    route_type varchar(1),
    person1_id integer,
    person2_id integer
)
WITH (oids = false);
--
-- Structure for table gwm_routes_wells (OID = 40360) : 
--
CREATE TABLE gwbase.gwm_routes_wells (
    route_id integer NOT NULL,
    well_id integer NOT NULL,
    seqnr integer
)
WITH (oids = false);
--
-- Structure for table gww_datastatus (OID = 40365) : 
--
CREATE TABLE gwbase.gww_datastatus (
    msid integer NOT NULL,
    datatype integer NOT NULL,
    paramid integer NOT NULL,
    count_ integer,
    mindate timestamp without time zone,
    maxdate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gww_layers (OID = 40370) : 
--
CREATE TABLE gwbase.gww_layers (
    id integer NOT NULL,
    filename varchar(255) NOT NULL,
    directory varchar(255) NOT NULL,
    layerclass integer,
    geotype varchar(20),
    displayname varchar(128),
    description text,
    definition text,
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone,
    sortno integer DEFAULT 32000
)
WITH (oids = false);
--
-- Structure for table gww_maps (OID = 40380) : 
--
CREATE TABLE gwbase.gww_maps (
    id integer NOT NULL,
    displayname varchar(128),
    name varchar(128),
    title varchar(128),
    url text,
    providername varchar(128),
    providerurl text,
    sourcename varchar(128),
    sourceurl text,
    crs varchar(16),
    crsname varchar(64),
    availablecrs text,
    abstract text,
    servicetype varchar(32),
    serviceversion varchar(16),
    jslayerdef text,
    gww char(1) DEFAULT '-'::bpchar,
    gwwtransferdate timestamp without time zone,
    sortno integer DEFAULT 32000,
    isoverlay varchar(1) DEFAULT '-'::character varying
)
WITH (oids = false);
--
-- Structure for table gww_mapservices (OID = 40391) : 
--
CREATE TABLE gwbase.gww_mapservices (
    id integer NOT NULL,
    name varchar(128),
    title varchar(128),
    servicetype varchar(32),
    serviceversion varchar(16),
    displaytitle varchar(128),
    abstract text,
    url text,
    providername varchar(128),
    providerurl text,
    sourcename varchar(128),
    sourceurl text,
    fees text,
    accessconstraints text,
    keywords text,
    contact text,
    attribution text,
    authorityurlname varchar(64),
    authorityurlhref text,
    identifierauthority varchar(64),
    identifierurl text,
    username varchar(64),
    userpassword varchar(64),
    sortno integer DEFAULT 32000
)
WITH (oids = false);
--
-- Structure for table gww_profiles (OID = 40400) : 
--
CREATE TABLE gwbase.gww_profiles (
    id integer NOT NULL,
    filename varchar(255) NOT NULL,
    directory varchar(255) NOT NULL,
    type integer,
    displayname varchar(128),
    description text,
    definition text,
    gww char(1) DEFAULT '-'::bpchar,
    gwwfiledate timestamp without time zone,
    sortno integer DEFAULT 32000
)
WITH (oids = false);
--
-- Structure for table gww_webconfig (OID = 40410) : 
--
CREATE TABLE gwbase.gww_webconfig (
    id integer NOT NULL,
    webarea_id integer,
    weborg_id integer,
    weborg_krz varchar(20),
    username varchar(50),
    userpassword varchar(50),
    webdomain varchar(50),
    path varchar(50),
    requestscript varchar(50),
    port integer,
    ssl char(1) DEFAULT '-'::bpchar,
    connecttimeout integer DEFAULT 5,
    readtimeout integer DEFAULT 20,
    http_paramsok char(1) DEFAULT '-'::bpchar,
    ftp_user varchar(50),
    ftp_password varchar(50),
    ftp_server varchar(50),
    ftp_path varchar(50),
    ftp_port integer,
    ftp_ssl char(1) DEFAULT '-'::bpchar,
    ftp_passivemode char(1) DEFAULT '+'::bpchar,
    ftp_connecttimeout integer DEFAULT 6,
    ftp_readtimeout integer DEFAULT 60,
    ftp_paramsok char(1) DEFAULT '-'::bpchar,
    proxy_user varchar(50),
    proxy_password varchar(50),
    proxy_server varchar(50),
    proxy_port integer,
    ftpproxy_user varchar(50),
    ftpproxy_password varchar(50),
    ftpproxy_server varchar(50),
    ftpproxy_port integer,
    usagefotos char(1) DEFAULT '+'::bpchar,
    usagewelldocuments char(1) DEFAULT '+'::bpchar,
    usagelevels integer DEFAULT 2,
    usageananlyses integer DEFAULT 2,
    usagelogger integer DEFAULT 2,
    usagerates integer DEFAULT 2,
    usageprecipitate integer DEFAULT 2,
    usageclimate integer DEFAULT 2,
    usageanamediumwater char(1) DEFAULT '+'::bpchar,
    usageanamediumsolid char(1) DEFAULT '-'::bpchar,
    usageanamediumeluat char(1) DEFAULT '-'::bpchar,
    usageanamediumair char(1) DEFAULT '-'::bpchar,
    usagecategories char(1) DEFAULT '+'::bpchar,
    usagesubprojects char(1) DEFAULT '+'::bpchar,
    usagesynonymes char(1) DEFAULT '+'::bpchar,
    usagelayers char(1) DEFAULT '+'::bpchar,
    usageprofiles char(1) DEFAULT '+'::bpchar,
    usageprojectdocument char(1) DEFAULT '+'::bpchar,
    gwbepsg varchar(16),
    gwbepsgname varchar(128),
    gwbutmepsg varchar(16),
    gwbutmepsgname varchar(128),
    gwwpreferedepsgtyp integer,
    gwwpreferedepsg varchar(16),
    gwwpreferedepsgname varchar(128),
    provevaluelistno integer,
    warningvaluelistno integer,
    logofile varchar(255),
    ftpproxy_http char(1) DEFAULT '-'::bpchar,
    ftpproxy_httpauthmethod varchar(20),
    preferedmapid integer,
    loginlogofile varchar(255),
    logoposition varchar(32) DEFAULT 'legbottom'::character varying,
    usagevaluemarkers char(1) DEFAULT '-'::bpchar,
    usagelevelcomments char(1) DEFAULT '-'::bpchar,
    logoimg bytea,
    loginlogoimg bytea,
    levelcommentshasflag char(1) DEFAULT '-'::bpchar,
    levelcommentsflagdefinition text,
    levelcommentsflagpreview bytea,
    levelbglnegative char(1) DEFAULT '-'::bpchar
)
WITH (oids = false);
--
-- Structure for table gww_welldatacounts (OID = 40447) : 
--
CREATE TABLE gwbase.gww_welldatacounts (
    msid integer NOT NULL,
    countlv integer,
    countan integer,
    countlg integer,
    countrt integer,
    countrn integer,
    countcl integer,
    countdo integer
)
WITH (oids = false);
--
-- Structure for table repitems (OID = 40452) : 
--
CREATE TABLE gwbase.repitems (
    id integer NOT NULL,
    reporttype integer NOT NULL,
    name varchar(50) NOT NULL,
    size integer,
    template bytea,
    project varchar(50)
)
WITH (oids = false);
--
-- Structure for table gwb_version (OID = 40741) : 
--
SET search_path = public, pg_catalog;
CREATE TABLE public.gwb_version (
    version char(10),
    version9 char(10),
    backupdate timestamp without time zone
)
WITH (oids = false);
--
-- Structure for table gwb_userselection (OID = 40744) : 
--
CREATE TABLE public.gwb_userselection (
    user_id integer NOT NULL,
    well_id integer NOT NULL,
    list_type integer
)
WITH (oids = false);
--
-- Structure for table gwb_surfacewaters (OID = 41273) : 
--
SET search_path = gwbase, pg_catalog;
CREATE TABLE gwbase.gwb_surfacewaters (
    id integer NOT NULL,
    itemname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_surfacewater_parts (OID = 41279) : 
--
CREATE TABLE gwbase.gwb_surfacewater_parts (
    id integer NOT NULL,
    main_id integer NOT NULL,
    itemname varchar(100) NOT NULL,
    seqnr integer
)
WITH (oids = false);
--
-- Structure for table gwb_param_valueclasses (OID = 41290) : 
--
CREATE TABLE gwbase.gwb_param_valueclasses (
    id integer NOT NULL,
    param_id integer NOT NULL,
    medium integer NOT NULL,
    classvalue double precision NOT NULL,
    classcolor integer
)
WITH (oids = false);
--
-- Structure for table db_version_ (OID = 41301) : 
--
CREATE TABLE gwbase.db_version_ (
    module_id varchar(32) NOT NULL,
    mandant_id integer,
    version integer
)
WITH (oids = false);
--
-- Structure for table gwb_catchmentareas (OID = 46393) : 
--
CREATE TABLE gwbase.gwb_catchmentareas (
    id integer NOT NULL,
    areaname varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table rst_appconfig (OID = 64400) : 
--
CREATE TABLE gwbase.rst_appconfig (
    mandant_id integer NOT NULL,
    module_id varchar(16) NOT NULL,
    key_ varchar(100) NOT NULL,
    value_i integer,
    value_f double precision,
    value_s text,
    value_dt date
)
WITH (oids = false);
--
-- Structure for table rst_dbversion (OID = 64408) : 
--
CREATE TABLE gwbase.rst_dbversion (
    mandant_id integer NOT NULL,
    module_id varchar(32) NOT NULL,
    version integer
)
WITH (oids = false);
--
-- Structure for table gwb_wellstdtodocategories (OID = 64413) : 
--
SET search_path = public, pg_catalog;
CREATE TABLE public.gwb_wellstdtodocategories (
    well_id integer NOT NULL,
    category_id integer NOT NULL,
    repeatmonths integer
)
WITH (oids = false);
--
-- Structure for table gwb_wellstdtodocategories (OID = 64418) : 
--
SET search_path = gwbase, pg_catalog;
CREATE TABLE gwbase.gwb_wellstdtodocategories (
    well_id integer NOT NULL,
    category_id integer NOT NULL,
    repeatmonths integer
)
WITH (oids = false);
--
-- Structure for table gwb_stationreports (OID = 64667) : 
--
CREATE TABLE gwbase.gwb_stationreports (
    id integer NOT NULL,
    description varchar(50),
    sortorder integer,
    parameter_id integer NOT NULL,
    stn1_id integer,
    stn2_id integer,
    stn3_id integer,
    stn4_id integer,
    stn5_id integer,
    stn6_id integer,
    stn7_id integer,
    stn8_id integer,
    stn9_id integer,
    stn10_id integer,
    thresholdtext varchar(50),
    thresholdvalue double precision
)
WITH (oids = false);
--
-- Structure for table gwb_wellproperties_values (OID = 64672) : 
--
CREATE TABLE gwbase.gwb_wellproperties_values (
    id integer NOT NULL,
    property_id integer NOT NULL,
    valuetext varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_manufacturercat (OID = 64682) : 
--
CREATE TABLE gwbase.gwb_techequip_manufacturercat (
    id integer NOT NULL,
    manufacturer varchar(70) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_techequip_typecat (OID = 64687) : 
--
CREATE TABLE gwbase.gwb_techequip_typecat (
    id integer NOT NULL,
    equiptype varchar(70) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwm_picturecategoriescat (OID = 64700) : 
--
CREATE TABLE gwbase.gwm_picturecategoriescat (
    id integer NOT NULL,
    picturecategory varchar(50) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_fieldchecks (OID = 64705) : 
--
CREATE TABLE gwbase.gwb_fieldchecks (
    tname varchar(100) NOT NULL,
    fname varchar(100) NOT NULL,
    fnamedisplay varchar(100),
    options integer,
    valuemin double precision,
    valuemax double precision,
    fcondition varchar(100)
)
WITH (oids = false);
--
-- Structure for table gwb_streetcat (OID = 64720) : 
--
CREATE TABLE gwbase.gwb_streetcat (
    streetkey varchar(20) NOT NULL,
    streetname varchar(100) NOT NULL
)
WITH (oids = false);
--
-- Structure for table gwb_logins (OID = 64738) : 
--
CREATE TABLE gwbase.gwb_logins (
    user_id integer NOT NULL,
    logintime timestamp without time zone NOT NULL,
    logofftime timestamp without time zone
)
WITH (oids = false);
--
-- Definition for index ix_appcfg_module (OID = 40580) : 
--
CREATE INDEX ix_appcfg_module ON app_config_ USING btree (module_id);
--
-- Definition for index ix_measdate_logger (OID = 40581) : 
--
CREATE INDEX ix_measdate_logger ON gwb_measdate USING btree (logger, messtellenid, messdatum);
--
-- Definition for index gwb_wstand_idx1 (OID = 40750) : 
--
CREATE UNIQUE INDEX gwb_wstand_idx1 ON gwb_wstand USING btree (messtellenid, datumzeit);
--
-- Definition for index gwb_wellstatuscat_ix1 (OID = 40751) : 
--
CREATE UNIQUE INDEX gwb_wellstatuscat_ix1 ON gwb_wellstatuscat USING btree (statusname);
--
-- Definition for index gwb_gwstockw_idx1 (OID = 40752) : 
--
CREATE INDEX gwb_gwstockw_idx1 ON gwb_gwstockw USING btree (grundwasserstockwerk);
--
-- Definition for index gwb_gwstockw_idx2 (OID = 40753) : 
--
CREATE INDEX gwb_gwstockw_idx2 ON gwb_gwstockw USING btree (seqnr);
--
-- Definition for index gwb_geologie_idx1 (OID = 40754) : 
--
CREATE INDEX gwb_geologie_idx1 ON gwb_geologie USING btree (geologischeeinheit);
--
-- Definition for index gwb_geologie_idx2 (OID = 40755) : 
--
CREATE INDEX gwb_geologie_idx2 ON gwb_geologie USING btree (seqnr);
--
-- Definition for index gwb_msstamm_idx1 (OID = 40756) : 
--
CREATE UNIQUE INDEX gwb_msstamm_idx1 ON gwb_msstamm USING btree (kennnr);
--
-- Definition for index gwb_msstamm_idx2 (OID = 40757) : 
--
CREATE INDEX gwb_msstamm_idx2 ON gwb_msstamm USING btree (kennnr2);
--
-- Definition for index gwb_paramet_idx1 (OID = 40758) : 
--
CREATE UNIQUE INDEX gwb_paramet_idx1 ON gwb_paramet USING btree (parameterkuerzel);
--
-- Definition for index gwb_measdate_idx1 (OID = 40759) : 
--
CREATE INDEX gwb_measdate_idx1 ON gwb_measdate USING btree (messtellenid, messdatum);
--
-- Definition for index gwb_valvetypecat_idx1 (OID = 40760) : 
--
CREATE UNIQUE INDEX gwb_valvetypecat_idx1 ON gwb_valvetypecat USING btree (itemname);
--
-- Definition for index gwb_buildigmaterialcat_idx1 (OID = 40761) : 
--
CREATE UNIQUE INDEX gwb_buildigmaterialcat_idx1 ON gwb_buildingmaterialcat USING btree (itemname);
--
-- Definition for index gwb_stoffkl_idx1 (OID = 40762) : 
--
CREATE INDEX gwb_stoffkl_idx1 ON gwb_stoffkl USING btree (name);
--
-- Definition for index gwb_class_param_idx1 (OID = 40763) : 
--
CREATE UNIQUE INDEX gwb_class_param_idx1 ON gwb_class_param USING btree (class_id, param_id);
--
-- Definition for index gwb_flowmeasurementcat_idx1 (OID = 40764) : 
--
CREATE UNIQUE INDEX gwb_flowmeasurementcat_idx1 ON gwb_flowmeasurementcat USING btree (itemname);
--
-- Definition for index gwb_projects_idx1 (OID = 40765) : 
--
CREATE INDEX gwb_projects_idx1 ON gwb_projects USING btree (projectdescr);
--
-- Definition for index gwb_pipetypecat_idx1 (OID = 40766) : 
--
CREATE UNIQUE INDEX gwb_pipetypecat_idx1 ON gwb_pipetypecat USING btree (itemname);
--
-- Definition for index gwb_watertypecat_idx1 (OID = 40767) : 
--
CREATE UNIQUE INDEX gwb_watertypecat_idx1 ON gwb_watertypecat USING btree (itemname);
--
-- Definition for index gwb_pipematerialcat_idx1 (OID = 40768) : 
--
CREATE UNIQUE INDEX gwb_pipematerialcat_idx1 ON gwb_pipematerialcat USING btree (itemname);
--
-- Definition for index gwb_techpartscat_idx1 (OID = 40769) : 
--
CREATE UNIQUE INDEX gwb_techpartscat_idx1 ON gwb_techpartscat USING btree (itemname);
--
-- Definition for index gwb_pipes_ix1 (OID = 40770) : 
--
CREATE UNIQUE INDEX gwb_pipes_ix1 ON gwb_pipes USING btree (pipename);
--
-- Definition for index gwb_reportgroups_idx1 (OID = 40771) : 
--
CREATE UNIQUE INDEX gwb_reportgroups_idx1 ON gwb_reportgroups USING btree (groupname);
--
-- Definition for index gwb_spec_yield_ix1 (OID = 40772) : 
--
CREATE UNIQUE INDEX gwb_spec_yield_ix1 ON gwb_spec_yield USING btree (well_id, mdate);
--
-- Definition for index gwb_stnflowdevicehistory_ix1 (OID = 40773) : 
--
CREATE UNIQUE INDEX gwb_stnflowdevicehistory_ix1 ON gwb_stnflowdevicehistory USING btree (flowdevice_id, flowdevicedate);
--
-- Definition for index gwb_techpartsclasscat_idx1 (OID = 40774) : 
--
CREATE UNIQUE INDEX gwb_techpartsclasscat_idx1 ON gwb_techpartsclasscat USING btree (itemname);
--
-- Definition for index gwb_wells_projects_idx1 (OID = 40775) : 
--
CREATE INDEX gwb_wells_projects_idx1 ON gwb_wells_projects USING btree (project_id, well_id);
--
-- Definition for index gwb_wellstatushistory_ix1 (OID = 40776) : 
--
CREATE UNIQUE INDEX gwb_wellstatushistory_ix1 ON gwb_wellstatushistory USING btree (well_id, statusdate);
--
-- Definition for index gwb_surfacewaters_idx1 (OID = 41278) : 
--
CREATE UNIQUE INDEX gwb_surfacewaters_idx1 ON gwb_surfacewaters USING btree (itemname);
--
-- Definition for index gwb_param_valueclasses_idx1 (OID = 41300) : 
--
CREATE UNIQUE INDEX gwb_param_valueclasses_idx1 ON gwb_param_valueclasses USING btree (param_id, medium, classvalue);
--
-- Definition for index ix_appcfg_modulekey (OID = 41350) : 
--
CREATE INDEX ix_appcfg_modulekey ON app_config_ USING btree (module_id, key_);
--
-- Definition for index ix_appcfg_mandmodkey (OID = 41351) : 
--
CREATE INDEX ix_appcfg_mandmodkey ON app_config_ USING btree (mandant_id, module_id, key_);
--
-- Definition for index ix_dbvers_mandmod (OID = 41352) : 
--
CREATE INDEX ix_dbvers_mandmod ON db_version_ USING btree (mandant_id, module_id);
--
-- Definition for index gwb_projects_idx2 (OID = 43216) : 
--
CREATE UNIQUE INDEX gwb_projects_idx2 ON gwb_projects USING btree (projectdescr, owner_id);
--
-- Definition for index gwb_catchmentarea_idx1 (OID = 46396) : 
--
CREATE UNIQUE INDEX gwb_catchmentarea_idx1 ON gwb_catchmentareas USING btree (areaname);
--
-- Definition for index gwb_surfacewaterparts_idx2 (OID = 62448) : 
--
CREATE UNIQUE INDEX gwb_surfacewaterparts_idx2 ON gwb_surfacewater_parts USING btree (main_id, itemname);
--
-- Definition for index pk_app_config_ (OID = 39302) : 
--
ALTER TABLE ONLY app_config_
    ADD CONSTRAINT pk_app_config_
    PRIMARY KEY (id);
--
-- Definition for index gpd_abweichungen_pk (OID = 39307) : 
--
ALTER TABLE ONLY gpd_abweichungen
    ADD CONSTRAINT gpd_abweichungen_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gwb_msstamm_pk (OID = 39336) : 
--
ALTER TABLE ONLY gwb_msstamm
    ADD CONSTRAINT gwb_msstamm_pk
    PRIMARY KEY (id);
--
-- Definition for index gpd_msstamm_pk (OID = 39344) : 
--
ALTER TABLE ONLY gpd_msstamm
    ADD CONSTRAINT gpd_msstamm_pk
    PRIMARY KEY (msid);
--
-- Definition for index gpd_asbbohrloch_pk (OID = 39349) : 
--
ALTER TABLE ONLY gpd_asbbohrloch
    ADD CONSTRAINT gpd_asbbohrloch_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_asbverrohrung_pk (OID = 39354) : 
--
ALTER TABLE ONLY gpd_asbverrohrung
    ADD CONSTRAINT gpd_asbverrohrung_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_asbfilter_pk (OID = 39359) : 
--
ALTER TABLE ONLY gpd_asbfilter
    ADD CONSTRAINT gpd_asbfilter_pk
    PRIMARY KEY (msid, afi_rohrrecid);
--
-- Definition for index gpd_asbsonderbau_pk (OID = 39364) : 
--
ALTER TABLE ONLY gpd_asbsonderbau
    ADD CONSTRAINT gpd_asbsonderbau_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_asbverfuellung_pk (OID = 39369) : 
--
ALTER TABLE ONLY gpd_asbverfuellung
    ADD CONSTRAINT gpd_asbverfuellung_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_hydroparam_pk (OID = 39377) : 
--
ALTER TABLE ONLY gpd_hydroparam
    ADD CONSTRAINT gpd_hydroparam_pk
    PRIMARY KEY (msid);
--
-- Definition for index gpd_kluefte_pk (OID = 39382) : 
--
ALTER TABLE ONLY gpd_kluefte
    ADD CONSTRAINT gpd_kluefte_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_log_pk (OID = 39390) : 
--
ALTER TABLE ONLY gpd_log
    ADD CONSTRAINT gpd_log_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_logdata_pk (OID = 39395) : 
--
ALTER TABLE ONLY gpd_logdata
    ADD CONSTRAINT gpd_logdata_pk
    PRIMARY KEY (msid, ld_logrecid, ld_recid);
--
-- Definition for index gpd_mspassconfig_pk (OID = 39403) : 
--
ALTER TABLE ONLY gpd_mspassconfig
    ADD CONSTRAINT gpd_mspassconfig_pk
    PRIMARY KEY (msid);
--
-- Definition for index gpd_mssynonyme_pk (OID = 39408) : 
--
ALTER TABLE ONLY gpd_mssynonyme
    ADD CONSTRAINT gpd_mssynonyme_pk
    PRIMARY KEY (msid, mssyn_id);
--
-- Definition for index gpd_packertest_pk (OID = 39413) : 
--
ALTER TABLE ONLY gpd_packertest
    ADD CONSTRAINT gpd_packertest_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_plfirma_pk (OID = 39421) : 
--
ALTER TABLE ONLY gpd_plfirma
    ADD CONSTRAINT gpd_plfirma_pk
    PRIMARY KEY (plf_id);
--
-- Definition for index gpd_plperson_pk (OID = 39426) : 
--
ALTER TABLE ONLY gpd_plperson
    ADD CONSTRAINT gpd_plperson_pk
    PRIMARY KEY (plp_id);
--
-- Definition for index gpd_plstandard_pk (OID = 39431) : 
--
ALTER TABLE ONLY gpd_plstandard
    ADD CONSTRAINT gpd_plstandard_pk
    PRIMARY KEY (pls_id);
--
-- Definition for index gpd_schichten_pk (OID = 39439) : 
--
ALTER TABLE ONLY gpd_schichten
    ADD CONSTRAINT gpd_schichten_pk
    PRIMARY KEY (msid, sd_layerid, sd_layercntr);
--
-- Definition for index gpd_schichttitel_pk (OID = 39444) : 
--
ALTER TABLE ONLY gpd_schichttitel
    ADD CONSTRAINT gpd_schichttitel_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_spuelung_pk (OID = 39449) : 
--
ALTER TABLE ONLY gpd_spuelung
    ADD CONSTRAINT gpd_spuelung_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_stratigraphie_pk (OID = 39457) : 
--
ALTER TABLE ONLY gpd_stratigraphie
    ADD CONSTRAINT gpd_stratigraphie_pk
    PRIMARY KEY (strt_id);
--
-- Definition for index gpd_stratlists_pk (OID = 39465) : 
--
ALTER TABLE ONLY gpd_stratlists
    ADD CONSTRAINT gpd_stratlists_pk
    PRIMARY KEY (slst_id);
--
-- Definition for index gpd_synonymkat_pk (OID = 39471) : 
--
ALTER TABLE ONLY gpd_synonymkat
    ADD CONSTRAINT gpd_synonymkat_pk
    PRIMARY KEY (id);
--
-- Definition for index gpd_tempausbau_pk (OID = 39476) : 
--
ALTER TABLE ONLY gpd_tempausbau
    ADD CONSTRAINT gpd_tempausbau_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_tempschichten_pk (OID = 39484) : 
--
ALTER TABLE ONLY gpd_tempschichten
    ADD CONSTRAINT gpd_tempschichten_pk
    PRIMARY KEY (msid, recid);
--
-- Definition for index gpd_wasserrecht_pk (OID = 39492) : 
--
ALTER TABLE ONLY gpd_wasserrecht
    ADD CONSTRAINT gpd_wasserrecht_pk
    PRIMARY KEY (msid);
--
-- Definition for index gwb_analymethods_pk (OID = 39497) : 
--
ALTER TABLE ONLY gwb_analymethods
    ADD CONSTRAINT gwb_analymethods_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_analysen_pk (OID = 39505) : 
--
ALTER TABLE ONLY gwb_analysen
    ADD CONSTRAINT gwb_analysen_pk
    PRIMARY KEY (datumid, parameterid);
--
-- Definition for index gwb_berichte_pk (OID = 39510) : 
--
ALTER TABLE ONLY gwb_berichte
    ADD CONSTRAINT gwb_berichte_pk
    PRIMARY KEY (berichtsnr);
--
-- Definition for index gwb_betreib_pk (OID = 39515) : 
--
ALTER TABLE ONLY gwb_betreib
    ADD CONSTRAINT gwb_betreib_pk
    PRIMARY KEY (betreiber);
--
-- Definition for index gwb_bohrfirm_pk (OID = 39520) : 
--
ALTER TABLE ONLY gwb_bohrfirm
    ADD CONSTRAINT gwb_bohrfirm_pk
    PRIMARY KEY (bohrfirma);
--
-- Definition for index gwb_bohrverf_pk (OID = 39525) : 
--
ALTER TABLE ONLY gwb_bohrverf
    ADD CONSTRAINT gwb_bohrverf_pk
    PRIMARY KEY (bohrverfahren);
--
-- Definition for index gwb_buildingmaterialcat_pk (OID = 39530) : 
--
ALTER TABLE ONLY gwb_buildingmaterialcat
    ADD CONSTRAINT gwb_buildingmaterialcat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_changelogger_pk (OID = 39541) : 
--
ALTER TABLE ONLY gwb_changelogger
    ADD CONSTRAINT gwb_changelogger_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_checkrules_pk (OID = 39548) : 
--
ALTER TABLE ONLY gwb_checkrules
    ADD CONSTRAINT gwb_checkrules_pk
    PRIMARY KEY (cr_wellid, cr_paramid, cr_ruletype);
--
-- Definition for index gwb_checkrules2_pk (OID = 39558) : 
--
ALTER TABLE ONLY gwb_checkrules2
    ADD CONSTRAINT gwb_checkrules2_pk
    PRIMARY KEY (cr_id);
--
-- Definition for index gwb_classparam_pk (OID = 39563) : 
--
ALTER TABLE ONLY gwb_class_param
    ADD CONSTRAINT gwb_classparam_pk
    PRIMARY KEY (param_id, class_id);
--
-- Definition for index gwb_dbversions_pk (OID = 39568) : 
--
ALTER TABLE ONLY gwb_dbversions
    ADD CONSTRAINT gwb_dbversions_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_doccategories_pk (OID = 39576) : 
--
ALTER TABLE ONLY gwb_doccategories
    ADD CONSTRAINT gwb_doccategories_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_doctypes_pk (OID = 39581) : 
--
ALTER TABLE ONLY gwb_doctypes
    ADD CONSTRAINT gwb_doctypes_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_einheit_pk (OID = 39586) : 
--
ALTER TABLE ONLY gwb_einheit
    ADD CONSTRAINT gwb_einheit_pk
    PRIMARY KEY (einheit);
--
-- Definition for index gwb_elevationquality_pk (OID = 39591) : 
--
ALTER TABLE ONLY gwb_elevationquality
    ADD CONSTRAINT gwb_elevationquality_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_flowmeasurementcat_pk (OID = 39596) : 
--
ALTER TABLE ONLY gwb_flowmeasurementcat
    ADD CONSTRAINT gwb_flowmeasurementcat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_geologie_pk (OID = 39601) : 
--
ALTER TABLE ONLY gwb_geologie
    ADD CONSTRAINT gwb_geologie_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_geraete_pk (OID = 39606) : 
--
ALTER TABLE ONLY gwb_geraete
    ADD CONSTRAINT gwb_geraete_pk
    PRIMARY KEY (probennahmegeraet);
--
-- Definition for index gwb_graphics_pk (OID = 39616) : 
--
ALTER TABLE ONLY gwb_graphics
    ADD CONSTRAINT gwb_graphics_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_groups_pk (OID = 39627) : 
--
ALTER TABLE ONLY gwb_groups
    ADD CONSTRAINT gwb_groups_pk
    PRIMARY KEY (g_id);
--
-- Definition for index gwb_gwstockw_pk (OID = 39632) : 
--
ALTER TABLE ONLY gwb_gwstockw
    ADD CONSTRAINT gwb_gwstockw_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_hchange_pk (OID = 39637) : 
--
ALTER TABLE ONLY gwb_hchange
    ADD CONSTRAINT gwb_hchange_pk
    PRIMARY KEY (messtellenid, datumaenderung);
--
-- Definition for index gwb_keyword_objects_pk (OID = 39655) : 
--
ALTER TABLE ONLY gwb_keyword_objects
    ADD CONSTRAINT gwb_keyword_objects_pk
    PRIMARY KEY (keyword_id, object_id, object_type);
--
-- Definition for index gwb_keywords_pk (OID = 39660) : 
--
ALTER TABLE ONLY gwb_keywords
    ADD CONSTRAINT gwb_keywords_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_labors_pk (OID = 39674) : 
--
ALTER TABLE ONLY gwb_labors
    ADD CONSTRAINT gwb_labors_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_level_attributes_pk (OID = 39679) : 
--
ALTER TABLE ONLY gwb_level_attributes
    ADD CONSTRAINT gwb_level_attributes_pk
    PRIMARY KEY (la_date_id, la_attribute_id);
--
-- Definition for index gwb_levelcomments_pk (OID = 39685) : 
--
ALTER TABLE ONLY gwb_levelcomments
    ADD CONSTRAINT gwb_levelcomments_pk
    PRIMARY KEY (commentid);
--
-- Definition for index gwb_maps_pk (OID = 39707) : 
--
ALTER TABLE ONLY gwb_maps
    ADD CONSTRAINT gwb_maps_pk
    PRIMARY KEY (mapcomment);
--
-- Definition for index gwb_maps_projects_pk (OID = 39712) : 
--
ALTER TABLE ONLY gwb_maps_projects
    ADD CONSTRAINT gwb_maps_projects_pk
    PRIMARY KEY (map_id, project_id);
--
-- Definition for index gwb_measdate_pk (OID = 39719) : 
--
ALTER TABLE ONLY gwb_measdate
    ADD CONSTRAINT gwb_measdate_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_memos_pk (OID = 39727) : 
--
ALTER TABLE ONLY gwb_memos
    ADD CONSTRAINT gwb_memos_pk
    PRIMARY KEY (well_id, memotype, date_id);
--
-- Definition for index gwb_msart_pk (OID = 39738) : 
--
ALTER TABLE ONLY gwb_msart
    ADD CONSTRAINT gwb_msart_pk
    PRIMARY KEY (msart);
--
-- Definition for index gwb_nutzung_pk (OID = 39743) : 
--
ALTER TABLE ONLY gwb_nutzung
    ADD CONSTRAINT gwb_nutzung_pk
    PRIMARY KEY (nutzung);
--
-- Definition for index gwb_object_pipes_pk (OID = 39748) : 
--
ALTER TABLE ONLY gwb_object_pipes
    ADD CONSTRAINT gwb_object_pipes_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_object_techparts_pk (OID = 39753) : 
--
ALTER TABLE ONLY gwb_object_techparts
    ADD CONSTRAINT gwb_object_techparts_pk
    PRIMARY KEY (id);
--
-- Definition for index pk_gwb_objecttypes (OID = 39758) : 
--
ALTER TABLE ONLY gwb_objecttypes
    ADD CONSTRAINT pk_gwb_objecttypes
    PRIMARY KEY (id);
--
-- Definition for index gwb_organisation_pk (OID = 39766) : 
--
ALTER TABLE ONLY gwb_organisation
    ADD CONSTRAINT gwb_organisation_pk
    PRIMARY KEY (org_id);
--
-- Definition for index gwb_paramet_pk (OID = 39789) : 
--
ALTER TABLE ONLY gwb_paramet
    ADD CONSTRAINT gwb_paramet_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_paramlists_pk (OID = 39797) : 
--
ALTER TABLE ONLY gwb_paramlists
    ADD CONSTRAINT gwb_paramlists_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_piconfig_pk (OID = 39802) : 
--
ALTER TABLE ONLY gwb_piconfig
    ADD CONSTRAINT gwb_piconfig_pk
    PRIMARY KEY (piid, fieldname);
--
-- Definition for index gwb_pipematerialcat_pk (OID = 39807) : 
--
ALTER TABLE ONLY gwb_pipematerialcat
    ADD CONSTRAINT gwb_pipematerialcat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_pipetypecat_pk (OID = 39815) : 
--
ALTER TABLE ONLY gwb_pipetypecat
    ADD CONSTRAINT gwb_pipetypecat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_proben_pk (OID = 39825) : 
--
ALTER TABLE ONLY gwb_proben
    ADD CONSTRAINT gwb_proben_pk
    PRIMARY KEY (datumid);
--
-- Definition for index gwb_progparam_pk (OID = 39830) : 
--
ALTER TABLE ONLY gwb_prog_param
    ADD CONSTRAINT gwb_progparam_pk
    PRIMARY KEY (prog_id, seqnr, param_id);
--
-- Definition for index gwb_proggroups_pk (OID = 39835) : 
--
ALTER TABLE ONLY gwb_proggroups
    ADD CONSTRAINT gwb_proggroups_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_proggroups_progs_pk (OID = 39840) : 
--
ALTER TABLE ONLY gwb_proggroups_progs
    ADD CONSTRAINT gwb_proggroups_progs_pk
    PRIMARY KEY (group_id, prog_id);
--
-- Definition for index gwb_projects_pk (OID = 39854) : 
--
ALTER TABLE ONLY gwb_projects
    ADD CONSTRAINT gwb_projects_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_projectsusers_pk (OID = 39859) : 
--
ALTER TABLE ONLY gwb_projects_users
    ADD CONSTRAINT gwb_projectsusers_pk
    PRIMARY KEY (pu_projectid, pu_loginname);
--
-- Definition for index gwb_pump_data_pk (OID = 39870) : 
--
ALTER TABLE ONLY gwb_pump_data
    ADD CONSTRAINT gwb_pump_data_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_pumpen_pk (OID = 39875) : 
--
ALTER TABLE ONLY gwb_pumpen
    ADD CONSTRAINT gwb_pumpen_pk
    PRIMARY KEY (pumpentyp);
--
-- Definition for index gwb_rainfall_pk (OID = 39880) : 
--
ALTER TABLE ONLY gwb_rainfall
    ADD CONSTRAINT gwb_rainfall_pk
    PRIMARY KEY (well_id, date1);
--
-- Definition for index gwb_rates_pk (OID = 39885) : 
--
ALTER TABLE ONLY gwb_rates
    ADD CONSTRAINT gwb_rates_pk
    PRIMARY KEY (messtellenid, datum1);
--
-- Definition for index gwb_reportgroups_pk (OID = 39890) : 
--
ALTER TABLE ONLY gwb_reportgroups
    ADD CONSTRAINT gwb_reportgroups_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_reportgroups_paramgroups_pk (OID = 39895) : 
--
ALTER TABLE ONLY gwb_reportgroups_paramgroups
    ADD CONSTRAINT gwb_reportgroups_paramgroups_pk
    PRIMARY KEY (group_id, paramgroup_id);
--
-- Definition for index gwb_reportgroups_params_pk (OID = 39900) : 
--
ALTER TABLE ONLY gwb_reportgroups_params
    ADD CONSTRAINT gwb_reportgroups_params_pk
    PRIMARY KEY (group_id, param_id);
--
-- Definition for index gwb_reportgroups_stations_pk (OID = 39905) : 
--
ALTER TABLE ONLY gwb_reportgroups_stations
    ADD CONSTRAINT gwb_reportgroups_stations_pk
    PRIMARY KEY (group_id, station_id);
--
-- Definition for index gwb_reportgroups_templates_pk (OID = 39910) : 
--
ALTER TABLE ONLY gwb_reportgroups_templates
    ADD CONSTRAINT gwb_reportgroups_templates_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_samplecaledar_pk (OID = 39915) : 
--
ALTER TABLE ONLY gwb_samplecalendar
    ADD CONSTRAINT gwb_samplecaledar_pk
    PRIMARY KEY (sampledate, well_id);
--
-- Definition for index gwb_samplecolor_pk (OID = 39920) : 
--
ALTER TABLE ONLY gwb_samplecolor
    ADD CONSTRAINT gwb_samplecolor_pk
    PRIMARY KEY (color);
--
-- Definition for index gwb_samplematerial_pk (OID = 39925) : 
--
ALTER TABLE ONLY gwb_samplematerial
    ADD CONSTRAINT gwb_samplematerial_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_samplesprogs_pk (OID = 39930) : 
--
ALTER TABLE ONLY gwb_samples_progs
    ADD CONSTRAINT gwb_samplesprogs_pk
    PRIMARY KEY (sample_id, prog_id);
--
-- Definition for index gwb_samplingreasons_pk (OID = 39960) : 
--
ALTER TABLE ONLY gwb_samplingreasons
    ADD CONSTRAINT gwb_samplingreasons_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_selections_pk (OID = 39968) : 
--
ALTER TABLE ONLY gwb_selections
    ADD CONSTRAINT gwb_selections_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_sensordepth_pk (OID = 39973) : 
--
ALTER TABLE ONLY gwb_sensordepth
    ADD CONSTRAINT gwb_sensordepth_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_siteeowners_pk (OID = 39978) : 
--
ALTER TABLE ONLY gwb_siteowners
    ADD CONSTRAINT gwb_siteeowners_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_spec_yield_pk (OID = 39983) : 
--
ALTER TABLE ONLY gwb_spec_yield
    ADD CONSTRAINT gwb_spec_yield_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_sqlrecherche_pk (OID = 39988) : 
--
ALTER TABLE ONLY gwb_sqlrecherche
    ADD CONSTRAINT gwb_sqlrecherche_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_stnflowdevicehistory_pk (OID = 39993) : 
--
ALTER TABLE ONLY gwb_stnflowdevicehistory
    ADD CONSTRAINT gwb_stnflowdevicehistory_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_stoffkl_pk (OID = 40009) : 
--
ALTER TABLE ONLY gwb_stoffkl
    ADD CONSTRAINT gwb_stoffkl_pk
    PRIMARY KEY (class_id);
--
-- Definition for index gwb_srnetaqui_pk (OID = 40014) : 
--
ALTER TABLE ONLY gwb_storedrivernet_aquifers
    ADD CONSTRAINT gwb_srnetaqui_pk
    PRIMARY KEY (storedrivernet_id, aquifer_id);
--
-- Definition for index gwb_srnetpnts_pk (OID = 40019) : 
--
ALTER TABLE ONLY gwb_storedrivernet_points
    ADD CONSTRAINT gwb_srnetpnts_pk
    PRIMARY KEY (storedrivernet_id, seqnr);
--
-- Definition for index gwb_srnet_pk (OID = 40024) : 
--
ALTER TABLE ONLY gwb_storedrivernets
    ADD CONSTRAINT gwb_srnet_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_structparts_pk (OID = 40029) : 
--
ALTER TABLE ONLY gwb_structparts
    ADD CONSTRAINT gwb_structparts_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_structpartaqui_pk (OID = 40034) : 
--
ALTER TABLE ONLY gwb_structparts_aquifers
    ADD CONSTRAINT gwb_structpartaqui_pk
    PRIMARY KEY (structpart_id, aquifer_id);
--
-- Definition for index gwb_sppoints_pk (OID = 40039) : 
--
ALTER TABLE ONLY gwb_structparts_points
    ADD CONSTRAINT gwb_sppoints_pk
    PRIMARY KEY (structpart_id, point_id);
--
-- Definition for index gwb_structpoints_pk (OID = 40044) : 
--
ALTER TABLE ONLY gwb_structpoints
    ADD CONSTRAINT gwb_structpoints_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_structures_pk (OID = 40049) : 
--
ALTER TABLE ONLY gwb_structures
    ADD CONSTRAINT gwb_structures_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_symbols_pk (OID = 40054) : 
--
ALTER TABLE ONLY gwb_symbols
    ADD CONSTRAINT gwb_symbols_pk
    PRIMARY KEY (symbolid);
--
-- Definition for index gwb_symbolscategories_pk (OID = 40059) : 
--
ALTER TABLE ONLY gwb_symbolscategories
    ADD CONSTRAINT gwb_symbolscategories_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_taste_pk (OID = 40064) : 
--
ALTER TABLE ONLY gwb_taste
    ADD CONSTRAINT gwb_taste_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequip_history_pk (OID = 40069) : 
--
ALTER TABLE ONLY gwb_techequip_history
    ADD CONSTRAINT gwb_techequip_history_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequip_repairs_pk (OID = 40077) : 
--
ALTER TABLE ONLY gwb_techequip_repairs
    ADD CONSTRAINT gwb_techequip_repairs_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequip_stores_pk (OID = 40085) : 
--
ALTER TABLE ONLY gwb_techequip_stores
    ADD CONSTRAINT gwb_techequip_stores_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequip_wells_pk (OID = 40093) : 
--
ALTER TABLE ONLY gwb_techequip_wells
    ADD CONSTRAINT gwb_techequip_wells_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequipment_pk (OID = 40101) : 
--
ALTER TABLE ONLY gwb_techequipment
    ADD CONSTRAINT gwb_techequipment_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techpartscat_pk (OID = 40106) : 
--
ALTER TABLE ONLY gwb_techpartscat
    ADD CONSTRAINT gwb_techpartscat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techpartsclasscat_pk (OID = 40111) : 
--
ALTER TABLE ONLY gwb_techpartsclasscat
    ADD CONSTRAINT gwb_techpartsclasscat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_todocategories_pk (OID = 40116) : 
--
ALTER TABLE ONLY gwb_todocategories
    ADD CONSTRAINT gwb_todocategories_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_topograf_pk (OID = 40121) : 
--
ALTER TABLE ONLY gwb_topograf
    ADD CONSTRAINT gwb_topograf_pk
    PRIMARY KEY (project_id, rechtswert, hochwert);
--
-- Definition for index gwb_ukat_pk (OID = 40126) : 
--
ALTER TABLE ONLY gwb_ukat
    ADD CONSTRAINT gwb_ukat_pk
    PRIMARY KEY (katalognr);
--
-- Definition for index gwb_umrech_pk (OID = 40131) : 
--
ALTER TABLE ONLY gwb_umrech
    ADD CONSTRAINT gwb_umrech_pk
    PRIMARY KEY (einheit1, einheit2);
--
-- Definition for index gwb_users_pk (OID = 40140) : 
--
ALTER TABLE ONLY gwb_users
    ADD CONSTRAINT gwb_users_pk
    PRIMARY KEY (us_loginname);
--
-- Definition for index gwb_valuemarkers_pk (OID = 40148) : 
--
ALTER TABLE ONLY gwb_valuemarkers
    ADD CONSTRAINT gwb_valuemarkers_pk
    PRIMARY KEY (marker);
--
-- Definition for index gwb_valveposition_pk (OID = 40153) : 
--
ALTER TABLE ONLY gwb_valveposition
    ADD CONSTRAINT gwb_valveposition_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_valves_pk (OID = 40158) : 
--
ALTER TABLE ONLY gwb_valves
    ADD CONSTRAINT gwb_valves_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_valvetypecat_pk (OID = 40163) : 
--
ALTER TABLE ONLY gwb_valvetypecat
    ADD CONSTRAINT gwb_valvetypecat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_virtualwells_pk (OID = 40173) : 
--
ALTER TABLE ONLY gwb_virtualwells
    ADD CONSTRAINT gwb_virtualwells_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wasserrecht_pk (OID = 40181) : 
--
ALTER TABLE ONLY gwb_wasserrecht
    ADD CONSTRAINT gwb_wasserrecht_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_waterquantity_pk (OID = 40186) : 
--
ALTER TABLE ONLY gwb_waterquantity
    ADD CONSTRAINT gwb_waterquantity_pk
    PRIMARY KEY (org_id, year);
--
-- Definition for index gwb_watertypecat_pk (OID = 40191) : 
--
ALTER TABLE ONLY gwb_watertypecat
    ADD CONSTRAINT gwb_watertypecat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wellgeology_pk (OID = 40196) : 
--
ALTER TABLE ONLY gwb_wellgeology
    ADD CONSTRAINT gwb_wellgeology_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wellproperties_pk (OID = 40201) : 
--
ALTER TABLE ONLY gwb_wellproperties
    ADD CONSTRAINT gwb_wellproperties_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wellprops__wells_pk (OID = 40206) : 
--
ALTER TABLE ONLY gwb_wellproperties_wells
    ADD CONSTRAINT gwb_wellprops__wells_pk
    PRIMARY KEY (property_id, well_id);
--
-- Definition for index gwb_wellpumprates_pk (OID = 40211) : 
--
ALTER TABLE ONLY gwb_wellpumprates
    ADD CONSTRAINT gwb_wellpumprates_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wells_projects_pk (OID = 40216) : 
--
ALTER TABLE ONLY gwb_wells_projects
    ADD CONSTRAINT gwb_wells_projects_pk
    PRIMARY KEY (well_id, project_id);
--
-- Definition for index gwb_wellstatuscat_pk (OID = 40221) : 
--
ALTER TABLE ONLY gwb_wellstatuscat
    ADD CONSTRAINT gwb_wellstatuscat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wellstatushistory_pk (OID = 40226) : 
--
ALTER TABLE ONLY gwb_wellstatushistory
    ADD CONSTRAINT gwb_wellstatushistory_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_welltodolist_pk (OID = 40234) : 
--
ALTER TABLE ONLY gwb_welltodolist
    ADD CONSTRAINT gwb_welltodolist_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wstand_pk (OID = 40250) : 
--
ALTER TABLE ONLY gwb_wstand
    ADD CONSTRAINT gwb_wstand_pk
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellaquifers (OID = 40257) : 
--
ALTER TABLE ONLY gwc_wellaquifers
    ADD CONSTRAINT pk_gwc_wellaquifers
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellcategories (OID = 40267) : 
--
ALTER TABLE ONLY gwc_wellcategories
    ADD CONSTRAINT pk_gwc_wellcategories
    PRIMARY KEY (type_id, category_id);
--
-- Definition for index pk_gwc_wellcategory_types (OID = 40273) : 
--
ALTER TABLE ONLY gwc_wellcategory_types
    ADD CONSTRAINT pk_gwc_wellcategory_types
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellgeology (OID = 40280) : 
--
ALTER TABLE ONLY gwc_wellgeology
    ADD CONSTRAINT pk_gwc_wellgeology
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellgroundowner (OID = 40287) : 
--
ALTER TABLE ONLY gwc_wellgroundowner
    ADD CONSTRAINT pk_gwc_wellgroundowner
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellkind (OID = 40294) : 
--
ALTER TABLE ONLY gwc_wellkind
    ADD CONSTRAINT pk_gwc_wellkind
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welllocation (OID = 40301) : 
--
ALTER TABLE ONLY gwc_welllocation
    ADD CONSTRAINT pk_gwc_welllocation
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welllocationfl (OID = 40308) : 
--
ALTER TABLE ONLY gwc_welllocationfl
    ADD CONSTRAINT pk_gwc_welllocationfl
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welllocationfs (OID = 40315) : 
--
ALTER TABLE ONLY gwc_welllocationfs
    ADD CONSTRAINT pk_gwc_welllocationfs
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welllocationge (OID = 40322) : 
--
ALTER TABLE ONLY gwc_welllocationge
    ADD CONSTRAINT pk_gwc_welllocationge
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welloperator (OID = 40329) : 
--
ALTER TABLE ONLY gwc_welloperator
    ADD CONSTRAINT pk_gwc_welloperator
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_wellsite (OID = 40336) : 
--
ALTER TABLE ONLY gwc_wellsite
    ADD CONSTRAINT pk_gwc_wellsite
    PRIMARY KEY (id);
--
-- Definition for index pk_gwc_welluse (OID = 40343) : 
--
ALTER TABLE ONLY gwc_welluse
    ADD CONSTRAINT pk_gwc_welluse
    PRIMARY KEY (id);
--
-- Definition for index gwb_depths_pk (OID = 40348) : 
--
ALTER TABLE ONLY gwm_depths
    ADD CONSTRAINT gwb_depths_pk
    PRIMARY KEY (well_id, depth);
--
-- Definition for index gwb_persons_pk (OID = 40353) : 
--
ALTER TABLE ONLY gwm_persons
    ADD CONSTRAINT gwb_persons_pk
    PRIMARY KEY (person_id);
--
-- Definition for index gwb_routes_pk (OID = 40358) : 
--
ALTER TABLE ONLY gwm_routes
    ADD CONSTRAINT gwb_routes_pk
    PRIMARY KEY (route_id);
--
-- Definition for index gwb_routes_wells_pk (OID = 40363) : 
--
ALTER TABLE ONLY gwm_routes_wells
    ADD CONSTRAINT gwb_routes_wells_pk
    PRIMARY KEY (route_id, well_id);
--
-- Definition for index pk_gww_datastatus (OID = 40368) : 
--
ALTER TABLE ONLY gww_datastatus
    ADD CONSTRAINT pk_gww_datastatus
    PRIMARY KEY (msid, datatype, paramid);
--
-- Definition for index pk_gww_layers (OID = 40378) : 
--
ALTER TABLE ONLY gww_layers
    ADD CONSTRAINT pk_gww_layers
    PRIMARY KEY (id);
--
-- Definition for index pk_gww_maps (OID = 40389) : 
--
ALTER TABLE ONLY gww_maps
    ADD CONSTRAINT pk_gww_maps
    PRIMARY KEY (id);
--
-- Definition for index pk_gww_mapservices (OID = 40398) : 
--
ALTER TABLE ONLY gww_mapservices
    ADD CONSTRAINT pk_gww_mapservices
    PRIMARY KEY (id);
--
-- Definition for index pk_gww_profiles (OID = 40408) : 
--
ALTER TABLE ONLY gww_profiles
    ADD CONSTRAINT pk_gww_profiles
    PRIMARY KEY (id);
--
-- Definition for index pk_gww_webconfig (OID = 40445) : 
--
ALTER TABLE ONLY gww_webconfig
    ADD CONSTRAINT pk_gww_webconfig
    PRIMARY KEY (id);
--
-- Definition for index pk_gww_welldatacounts (OID = 40450) : 
--
ALTER TABLE ONLY gww_welldatacounts
    ADD CONSTRAINT pk_gww_welldatacounts
    PRIMARY KEY (msid);
--
-- Definition for index repitems_pk (OID = 40458) : 
--
ALTER TABLE ONLY repitems
    ADD CONSTRAINT repitems_pk
    PRIMARY KEY (id);
--
-- Definition for index fk_gpd_msstamm_1 (OID = 40479) : 
--
ALTER TABLE ONLY gpd_msstamm
    ADD CONSTRAINT fk_gpd_msstamm_1
    FOREIGN KEY (msid) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_asbbohrloch_1 (OID = 40484) : 
--
ALTER TABLE ONLY gpd_asbbohrloch
    ADD CONSTRAINT fk_gpd_asbbohrloch_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_asbverrohrung_1 (OID = 40489) : 
--
ALTER TABLE ONLY gpd_asbverrohrung
    ADD CONSTRAINT fk_gpd_asbverrohrung_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_asbfilter_1 (OID = 40494) : 
--
ALTER TABLE ONLY gpd_asbfilter
    ADD CONSTRAINT fk_gpd_asbfilter_1
    FOREIGN KEY (msid, afi_rohrrecid) REFERENCES gpd_asbverrohrung(msid, recid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_asbsonderbau_1 (OID = 40499) : 
--
ALTER TABLE ONLY gpd_asbsonderbau
    ADD CONSTRAINT fk_gpd_asbsonderbau_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_asbverfuellung_1 (OID = 40504) : 
--
ALTER TABLE ONLY gpd_asbverfuellung
    ADD CONSTRAINT fk_gpd_asbverfuellung_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_hydroparam_1 (OID = 40509) : 
--
ALTER TABLE ONLY gpd_hydroparam
    ADD CONSTRAINT fk_gpd_hydroparam_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_kluefte_1 (OID = 40514) : 
--
ALTER TABLE ONLY gpd_kluefte
    ADD CONSTRAINT fk_gpd_kluefte_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_log_1 (OID = 40519) : 
--
ALTER TABLE ONLY gpd_log
    ADD CONSTRAINT fk_gpd_log_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_logdata_1 (OID = 40524) : 
--
ALTER TABLE ONLY gpd_logdata
    ADD CONSTRAINT fk_gpd_logdata_1
    FOREIGN KEY (msid, ld_logrecid) REFERENCES gpd_log(msid, recid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_mspassconfig_1 (OID = 40529) : 
--
ALTER TABLE ONLY gpd_mspassconfig
    ADD CONSTRAINT fk_gpd_mspassconfig_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_mssynonyme_1 (OID = 40534) : 
--
ALTER TABLE ONLY gpd_mssynonyme
    ADD CONSTRAINT fk_gpd_mssynonyme_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_packertest_1 (OID = 40539) : 
--
ALTER TABLE ONLY gpd_packertest
    ADD CONSTRAINT fk_gpd_packertest_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_schichten_1 (OID = 40544) : 
--
ALTER TABLE ONLY gpd_schichten
    ADD CONSTRAINT fk_gpd_schichten_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_schichttitel_1 (OID = 40549) : 
--
ALTER TABLE ONLY gpd_schichttitel
    ADD CONSTRAINT fk_gpd_schichttitel_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_spuelung_1 (OID = 40554) : 
--
ALTER TABLE ONLY gpd_spuelung
    ADD CONSTRAINT fk_gpd_spuelung_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index fk_gpd_wasserrecht_1 (OID = 40559) : 
--
ALTER TABLE ONLY gpd_wasserrecht
    ADD CONSTRAINT fk_gpd_wasserrecht_1
    FOREIGN KEY (msid) REFERENCES gpd_msstamm(msid) ON DELETE CASCADE;
--
-- Definition for index gwb_analy_methods_fk (OID = 40564) : 
--
ALTER TABLE ONLY gwb_analysen
    ADD CONSTRAINT gwb_analy_methods_fk
    FOREIGN KEY (method_id) REFERENCES gwb_analymethods(id);
--
-- Definition for index gwb_param_methods_fk (OID = 40569) : 
--
ALTER TABLE ONLY gwb_paramet
    ADD CONSTRAINT gwb_param_methods_fk
    FOREIGN KEY (stdmethod_id) REFERENCES gwb_analymethods(id);
--
-- Definition for index gwb_sensordepth_well_fk (OID = 40574) : 
--
ALTER TABLE ONLY gwb_sensordepth
    ADD CONSTRAINT gwb_sensordepth_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_msstamm_status_fk (OID = 40777) : 
--
ALTER TABLE ONLY gwb_msstamm
    ADD CONSTRAINT gwb_msstamm_status_fk
    FOREIGN KEY (status_id) REFERENCES gwb_wellstatuscat(id);
--
-- Definition for index gwb_wells_aquifer_fk (OID = 40782) : 
--
ALTER TABLE ONLY gwb_msstamm
    ADD CONSTRAINT gwb_wells_aquifer_fk
    FOREIGN KEY (aquifer_id) REFERENCES gwb_gwstockw(id);
--
-- Definition for index gwb_wells_geology_fk (OID = 40787) : 
--
ALTER TABLE ONLY gwb_msstamm
    ADD CONSTRAINT gwb_wells_geology_fk
    FOREIGN KEY (geology_id) REFERENCES gwb_geologie(id);
--
-- Definition for index gwb_measdate_well_fk (OID = 40792) : 
--
ALTER TABLE ONLY gwb_measdate
    ADD CONSTRAINT gwb_measdate_well_fk
    FOREIGN KEY (messtellenid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_analysen_measdate_fk (OID = 40797) : 
--
ALTER TABLE ONLY gwb_analysen
    ADD CONSTRAINT gwb_analysen_measdate_fk
    FOREIGN KEY (datumid) REFERENCES gwb_measdate(id);
--
-- Definition for index gwb_analysen_parameter_fk (OID = 40817) : 
--
ALTER TABLE ONLY gwb_analysen
    ADD CONSTRAINT gwb_analysen_parameter_fk
    FOREIGN KEY (parameterid) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_checkrules_param_fk (OID = 40822) : 
--
ALTER TABLE ONLY gwb_checkrules
    ADD CONSTRAINT gwb_checkrules_param_fk
    FOREIGN KEY (cr_paramid) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_checkrules_well_fk (OID = 40827) : 
--
ALTER TABLE ONLY gwb_checkrules
    ADD CONSTRAINT gwb_checkrules_well_fk
    FOREIGN KEY (cr_wellid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_checkrulestempl_param_fk (OID = 40832) : 
--
ALTER TABLE ONLY gwb_checkrules_templates
    ADD CONSTRAINT gwb_checkrulestempl_param_fk
    FOREIGN KEY (cr_paramid) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_checkrules2_param_fk (OID = 40837) : 
--
ALTER TABLE ONLY gwb_checkrules2
    ADD CONSTRAINT gwb_checkrules2_param_fk
    FOREIGN KEY (cr_paramid) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_checkrules2_well_fk (OID = 40842) : 
--
ALTER TABLE ONLY gwb_checkrules2
    ADD CONSTRAINT gwb_checkrules2_well_fk
    FOREIGN KEY (cr_wellid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_stoffkl_paramet_fk (OID = 40847) : 
--
ALTER TABLE ONLY gwb_stoffkl
    ADD CONSTRAINT gwb_stoffkl_paramet_fk
    FOREIGN KEY (sumparam_id) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_classparam_class_fk (OID = 40852) : 
--
ALTER TABLE ONLY gwb_class_param
    ADD CONSTRAINT gwb_classparam_class_fk
    FOREIGN KEY (class_id) REFERENCES gwb_stoffkl(class_id);
--
-- Definition for index gwb_classparam_parameter_fk (OID = 40857) : 
--
ALTER TABLE ONLY gwb_class_param
    ADD CONSTRAINT gwb_classparam_parameter_fk
    FOREIGN KEY (param_id) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_hchange_wells_fk (OID = 40867) : 
--
ALTER TABLE ONLY gwb_hchange
    ADD CONSTRAINT gwb_hchange_wells_fk
    FOREIGN KEY (messtellenid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_inoutletstructure_object_fk (OID = 40872) : 
--
ALTER TABLE ONLY gwb_inoutletstructure
    ADD CONSTRAINT gwb_inoutletstructure_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_wstand_wells_fk (OID = 40882) : 
--
ALTER TABLE ONLY gwb_wstand
    ADD CONSTRAINT gwb_wstand_wells_fk
    FOREIGN KEY (messtellenid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_levelcomm_todocat_fk (OID = 40887) : 
--
ALTER TABLE ONLY gwb_levelcomments
    ADD CONSTRAINT gwb_levelcomm_todocat_fk
    FOREIGN KEY (todocategory_id) REFERENCES gwb_todocategories(id);
--
-- Definition for index gwb_levelattr_comments_fk (OID = 40892) : 
--
ALTER TABLE ONLY gwb_level_attributes
    ADD CONSTRAINT gwb_levelattr_comments_fk
    FOREIGN KEY (la_attribute_id) REFERENCES gwb_levelcomments(commentid);
--
-- Definition for index gwb_levelattr_date_fk (OID = 40902) : 
--
ALTER TABLE ONLY gwb_level_attributes
    ADD CONSTRAINT gwb_levelattr_date_fk
    FOREIGN KEY (la_date_id) REFERENCES gwb_wstand(id);
--
-- Definition for index gwb_manhole_material_fk (OID = 40907) : 
--
ALTER TABLE ONLY gwb_manhole
    ADD CONSTRAINT gwb_manhole_material_fk
    FOREIGN KEY (material_id) REFERENCES gwb_buildingmaterialcat(id);
--
-- Definition for index gwb_manhole_object_fk (OID = 40922) : 
--
ALTER TABLE ONLY gwb_manhole
    ADD CONSTRAINT gwb_manhole_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_memos_wells_fk (OID = 40927) : 
--
ALTER TABLE ONLY gwb_memos
    ADD CONSTRAINT gwb_memos_wells_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_miscstructure_object_fk (OID = 40932) : 
--
ALTER TABLE ONLY gwb_miscstructure
    ADD CONSTRAINT gwb_miscstructure_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_object_pipes_material_fk (OID = 40937) : 
--
ALTER TABLE ONLY gwb_object_pipes
    ADD CONSTRAINT gwb_object_pipes_material_fk
    FOREIGN KEY (material_id) REFERENCES gwb_pipematerialcat(id);
--
-- Definition for index gwb_object_pipes_object_fk (OID = 40942) : 
--
ALTER TABLE ONLY gwb_object_pipes
    ADD CONSTRAINT gwb_object_pipes_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_object_pipes_pipetype_fk (OID = 40947) : 
--
ALTER TABLE ONLY gwb_object_pipes
    ADD CONSTRAINT gwb_object_pipes_pipetype_fk
    FOREIGN KEY (pipetype_id) REFERENCES gwb_pipetypecat(id);
--
-- Definition for index gwb_object_pipes_watertype_fk (OID = 40952) : 
--
ALTER TABLE ONLY gwb_object_pipes
    ADD CONSTRAINT gwb_object_pipes_watertype_fk
    FOREIGN KEY (watertype_id) REFERENCES gwb_watertypecat(id);
--
-- Definition for index gwb_object_techparts_object_fk (OID = 40957) : 
--
ALTER TABLE ONLY gwb_object_techparts
    ADD CONSTRAINT gwb_object_techparts_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_object_techparts_part_fk (OID = 40962) : 
--
ALTER TABLE ONLY gwb_object_techparts
    ADD CONSTRAINT gwb_object_techparts_part_fk
    FOREIGN KEY (part_id) REFERENCES gwb_techpartscat(id);
--
-- Definition for index gwb_proben_measdate_fk (OID = 40967) : 
--
ALTER TABLE ONLY gwb_proben
    ADD CONSTRAINT gwb_proben_measdate_fk
    FOREIGN KEY (datumid) REFERENCES gwb_measdate(id);
--
-- Definition for index gwb_proben_reason_fk (OID = 40972) : 
--
ALTER TABLE ONLY gwb_proben
    ADD CONSTRAINT gwb_proben_reason_fk
    FOREIGN KEY (reason_id) REFERENCES gwb_samplingreasons(id);
--
-- Definition for index gwb_progparam_parameter_fk (OID = 40977) : 
--
ALTER TABLE ONLY gwb_prog_param
    ADD CONSTRAINT gwb_progparam_parameter_fk
    FOREIGN KEY (param_id) REFERENCES gwb_paramet(id);
--
-- Definition for index gwb_progparam_prog_fk (OID = 40982) : 
--
ALTER TABLE ONLY gwb_prog_param
    ADD CONSTRAINT gwb_progparam_prog_fk
    FOREIGN KEY (prog_id) REFERENCES gwb_ukat(katalognr);
--
-- Definition for index gwb_proggroups_group_fk (OID = 40987) : 
--
ALTER TABLE ONLY gwb_proggroups_progs
    ADD CONSTRAINT gwb_proggroups_group_fk
    FOREIGN KEY (group_id) REFERENCES gwb_proggroups(id);
--
-- Definition for index gwb_proggroups_prog_fk (OID = 40992) : 
--
ALTER TABLE ONLY gwb_proggroups_progs
    ADD CONSTRAINT gwb_proggroups_prog_fk
    FOREIGN KEY (prog_id) REFERENCES gwb_ukat(katalognr);
--
-- Definition for index gwb_projectsusers_projects_fk (OID = 40997) : 
--
ALTER TABLE ONLY gwb_projects_users
    ADD CONSTRAINT gwb_projectsusers_projects_fk
    FOREIGN KEY (pu_projectid) REFERENCES gwb_projects(id);
--
-- Definition for index gwb_projectsusers_users_fk (OID = 41002) : 
--
ALTER TABLE ONLY gwb_projects_users
    ADD CONSTRAINT gwb_projectsusers_users_fk
    FOREIGN KEY (pu_loginname) REFERENCES gwb_users(us_loginname);
--
-- Definition for index gwb_pumpdata_t_fk (OID = 41007) : 
--
ALTER TABLE ONLY gwb_pump_data
    ADD CONSTRAINT gwb_pumpdata_t_fk
    FOREIGN KEY (equip_id) REFERENCES gwb_techequipment(id);
--
-- Definition for index gwb_pumpdata_well_fk (OID = 41012) : 
--
ALTER TABLE ONLY gwb_pump_data
    ADD CONSTRAINT gwb_pumpdata_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_rainfall_wells_fk (OID = 41017) : 
--
ALTER TABLE ONLY gwb_rainfall
    ADD CONSTRAINT gwb_rainfall_wells_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_rates_wells_fk (OID = 41022) : 
--
ALTER TABLE ONLY gwb_rates
    ADD CONSTRAINT gwb_rates_wells_fk
    FOREIGN KEY (messtellenid) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_rgpg_group_fk (OID = 41027) : 
--
ALTER TABLE ONLY gwb_reportgroups_paramgroups
    ADD CONSTRAINT gwb_rgpg_group_fk
    FOREIGN KEY (group_id) REFERENCES gwb_reportgroups(id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgpg_paramgroup_fk (OID = 41032) : 
--
ALTER TABLE ONLY gwb_reportgroups_paramgroups
    ADD CONSTRAINT gwb_rgpg_paramgroup_fk
    FOREIGN KEY (paramgroup_id) REFERENCES gwb_stoffkl(class_id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgp_group_fk (OID = 41037) : 
--
ALTER TABLE ONLY gwb_reportgroups_params
    ADD CONSTRAINT gwb_rgp_group_fk
    FOREIGN KEY (group_id) REFERENCES gwb_reportgroups(id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgp_param_fk (OID = 41042) : 
--
ALTER TABLE ONLY gwb_reportgroups_params
    ADD CONSTRAINT gwb_rgp_param_fk
    FOREIGN KEY (param_id) REFERENCES gwb_paramet(id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgs_group_fk (OID = 41047) : 
--
ALTER TABLE ONLY gwb_reportgroups_stations
    ADD CONSTRAINT gwb_rgs_group_fk
    FOREIGN KEY (group_id) REFERENCES gwb_reportgroups(id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgs_station_fk (OID = 41052) : 
--
ALTER TABLE ONLY gwb_reportgroups_stations
    ADD CONSTRAINT gwb_rgs_station_fk
    FOREIGN KEY (station_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_rgt_group_fk (OID = 41057) : 
--
ALTER TABLE ONLY gwb_reportgroups_templates
    ADD CONSTRAINT gwb_rgt_group_fk
    FOREIGN KEY (group_id) REFERENCES gwb_reportgroups(id) ON DELETE CASCADE;
--
-- Definition for index gwb_samplecalendar_prgr_fk (OID = 41062) : 
--
ALTER TABLE ONLY gwb_samplecalendar
    ADD CONSTRAINT gwb_samplecalendar_prgr_fk
    FOREIGN KEY (proggroup_id) REFERENCES gwb_proggroups(id);
--
-- Definition for index gwb_samplecalendar_well_fk (OID = 41067) : 
--
ALTER TABLE ONLY gwb_samplecalendar
    ADD CONSTRAINT gwb_samplecalendar_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_samplesprogs_prog_fk (OID = 41072) : 
--
ALTER TABLE ONLY gwb_samples_progs
    ADD CONSTRAINT gwb_samplesprogs_prog_fk
    FOREIGN KEY (prog_id) REFERENCES gwb_ukat(katalognr);
--
-- Definition for index gwb_samplesprogs_sample_fk (OID = 41077) : 
--
ALTER TABLE ONLY gwb_samples_progs
    ADD CONSTRAINT gwb_samplesprogs_sample_fk
    FOREIGN KEY (sample_id) REFERENCES gwb_measdate(id);
--
-- Definition for index gwb_spec_yield_well_fk (OID = 41082) : 
--
ALTER TABLE ONLY gwb_spec_yield
    ADD CONSTRAINT gwb_spec_yield_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_stnflowdevicehistory_device_fk (OID = 41087) : 
--
ALTER TABLE ONLY gwb_stnflowdevicehistory
    ADD CONSTRAINT gwb_stnflowdevicehistory_device_fk
    FOREIGN KEY (flowdevice_id) REFERENCES gwb_flowmeasurementcat(id);
--
-- Definition for index gwb_stnflowdevicehistory_stn_fk (OID = 41092) : 
--
ALTER TABLE ONLY gwb_stnflowdevicehistory
    ADD CONSTRAINT gwb_stnflowdevicehistory_stn_fk
    FOREIGN KEY (station_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_srnetaqui_aquifer_fk (OID = 41097) : 
--
ALTER TABLE ONLY gwb_storedrivernet_aquifers
    ADD CONSTRAINT gwb_srnetaqui_aquifer_fk
    FOREIGN KEY (aquifer_id) REFERENCES gwb_gwstockw(id);
--
-- Definition for index gwb_srnetaqui_rivernet_fk (OID = 41102) : 
--
ALTER TABLE ONLY gwb_storedrivernet_aquifers
    ADD CONSTRAINT gwb_srnetaqui_rivernet_fk
    FOREIGN KEY (storedrivernet_id) REFERENCES gwb_storedrivernets(id);
--
-- Definition for index gwb_srnetpnts_rivernet_fk (OID = 41107) : 
--
ALTER TABLE ONLY gwb_storedrivernet_points
    ADD CONSTRAINT gwb_srnetpnts_rivernet_fk
    FOREIGN KEY (storedrivernet_id) REFERENCES gwb_storedrivernets(id);
--
-- Definition for index gwb_structparts_struct_fk (OID = 41112) : 
--
ALTER TABLE ONLY gwb_structparts
    ADD CONSTRAINT gwb_structparts_struct_fk
    FOREIGN KEY (struct_id) REFERENCES gwb_structures(id);
--
-- Definition for index gwb_spaqui_aquifer_fk (OID = 41117) : 
--
ALTER TABLE ONLY gwb_structparts_aquifers
    ADD CONSTRAINT gwb_spaqui_aquifer_fk
    FOREIGN KEY (aquifer_id) REFERENCES gwb_gwstockw(id);
--
-- Definition for index gwb_spaqui_structpart_fk (OID = 41122) : 
--
ALTER TABLE ONLY gwb_structparts_aquifers
    ADD CONSTRAINT gwb_spaqui_structpart_fk
    FOREIGN KEY (structpart_id) REFERENCES gwb_structparts(id);
--
-- Definition for index gwb_structpoints_wells_fk (OID = 41127) : 
--
ALTER TABLE ONLY gwb_structpoints
    ADD CONSTRAINT gwb_structpoints_wells_fk
    FOREIGN KEY (station_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_sppoints_structpart_fk (OID = 41132) : 
--
ALTER TABLE ONLY gwb_structparts_points
    ADD CONSTRAINT gwb_sppoints_structpart_fk
    FOREIGN KEY (structpart_id) REFERENCES gwb_structparts(id);
--
-- Definition for index gwb_sppoints_structpoint_fk (OID = 41137) : 
--
ALTER TABLE ONLY gwb_structparts_points
    ADD CONSTRAINT gwb_sppoints_structpoint_fk
    FOREIGN KEY (point_id) REFERENCES gwb_structpoints(id);
--
-- Definition for index gwb_tehistory_equip_fk (OID = 41142) : 
--
ALTER TABLE ONLY gwb_techequip_history
    ADD CONSTRAINT gwb_tehistory_equip_fk
    FOREIGN KEY (equip_id) REFERENCES gwb_techequipment(id);
--
-- Definition for index gwb_tehistory_well_fk (OID = 41147) : 
--
ALTER TABLE ONLY gwb_techequip_history
    ADD CONSTRAINT gwb_tehistory_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_terepairs_equip_fk (OID = 41152) : 
--
ALTER TABLE ONLY gwb_techequip_repairs
    ADD CONSTRAINT gwb_terepairs_equip_fk
    FOREIGN KEY (equip_id) REFERENCES gwb_techequipment(id);
--
-- Definition for index gwb_terepairs_history_fk (OID = 41157) : 
--
ALTER TABLE ONLY gwb_techequip_repairs
    ADD CONSTRAINT gwb_terepairs_history_fk
    FOREIGN KEY (history_id) REFERENCES gwb_techequip_history(id);
--
-- Definition for index gwb_testores_equip_fk (OID = 41162) : 
--
ALTER TABLE ONLY gwb_techequip_stores
    ADD CONSTRAINT gwb_testores_equip_fk
    FOREIGN KEY (equip_id) REFERENCES gwb_techequipment(id);
--
-- Definition for index gwb_testores_history_fk (OID = 41167) : 
--
ALTER TABLE ONLY gwb_techequip_stores
    ADD CONSTRAINT gwb_testores_history_fk
    FOREIGN KEY (history_id) REFERENCES gwb_techequip_history(id);
--
-- Definition for index gwb_tewells_equip_fk (OID = 41172) : 
--
ALTER TABLE ONLY gwb_techequip_wells
    ADD CONSTRAINT gwb_tewells_equip_fk
    FOREIGN KEY (equip_id) REFERENCES gwb_techequipment(id);
--
-- Definition for index gwb_tewells_history_fk (OID = 41177) : 
--
ALTER TABLE ONLY gwb_techequip_wells
    ADD CONSTRAINT gwb_tewells_history_fk
    FOREIGN KEY (history_id) REFERENCES gwb_techequip_history(id);
--
-- Definition for index gwb_valves_object_fk (OID = 41182) : 
--
ALTER TABLE ONLY gwb_valves
    ADD CONSTRAINT gwb_valves_object_fk
    FOREIGN KEY (object_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_valveposition_valve_fk (OID = 41187) : 
--
ALTER TABLE ONLY gwb_valveposition
    ADD CONSTRAINT gwb_valveposition_valve_fk
    FOREIGN KEY (valve_id) REFERENCES gwb_valves(id) ON DELETE CASCADE;
--
-- Definition for index gwb_virtualwells_wells_fk (OID = 41192) : 
--
ALTER TABLE ONLY gwb_virtualwells
    ADD CONSTRAINT gwb_virtualwells_wells_fk
    FOREIGN KEY (referencestation_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_waterquantity_org_fk (OID = 41197) : 
--
ALTER TABLE ONLY gwb_waterquantity
    ADD CONSTRAINT gwb_waterquantity_org_fk
    FOREIGN KEY (org_id) REFERENCES gwb_organisation(org_id);
--
-- Definition for index gwb_wellgeology_geol_fk (OID = 41202) : 
--
ALTER TABLE ONLY gwb_wellgeology
    ADD CONSTRAINT gwb_wellgeology_geol_fk
    FOREIGN KEY (geology_id) REFERENCES gwb_geologie(id);
--
-- Definition for index gwb_wellgeology_well_fk (OID = 41207) : 
--
ALTER TABLE ONLY gwb_wellgeology
    ADD CONSTRAINT gwb_wellgeology_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_wellsprojects_projects_fk (OID = 41212) : 
--
ALTER TABLE ONLY gwb_wells_projects
    ADD CONSTRAINT gwb_wellsprojects_projects_fk
    FOREIGN KEY (project_id) REFERENCES gwb_projects(id);
--
-- Definition for index gwb_wellsprojects_wells_fk (OID = 41217) : 
--
ALTER TABLE ONLY gwb_wells_projects
    ADD CONSTRAINT gwb_wellsprojects_wells_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_wellstatushistory_status_fk (OID = 41222) : 
--
ALTER TABLE ONLY gwb_wellstatushistory
    ADD CONSTRAINT gwb_wellstatushistory_status_fk
    FOREIGN KEY (status_id) REFERENCES gwb_wellstatuscat(id);
--
-- Definition for index gwb_wellstatushistory_well_fk (OID = 41227) : 
--
ALTER TABLE ONLY gwb_wellstatushistory
    ADD CONSTRAINT gwb_wellstatushistory_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id) ON DELETE CASCADE;
--
-- Definition for index gwb_welltodolist_cat_fk (OID = 41232) : 
--
ALTER TABLE ONLY gwb_welltodolist
    ADD CONSTRAINT gwb_welltodolist_cat_fk
    FOREIGN KEY (category_id) REFERENCES gwb_todocategories(id);
--
-- Definition for index gwb_welltodolist_well_fk (OID = 41237) : 
--
ALTER TABLE ONLY gwb_welltodolist
    ADD CONSTRAINT gwb_welltodolist_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwm_depths_well_fk (OID = 41242) : 
--
ALTER TABLE ONLY gwm_depths
    ADD CONSTRAINT gwm_depths_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwm_routeswells_route_fk (OID = 41247) : 
--
ALTER TABLE ONLY gwm_routes_wells
    ADD CONSTRAINT gwm_routeswells_route_fk
    FOREIGN KEY (route_id) REFERENCES gwm_routes(route_id);
--
-- Definition for index gwm_routeswells_well_fk (OID = 41252) : 
--
ALTER TABLE ONLY gwm_routes_wells
    ADD CONSTRAINT gwm_routeswells_well_fk
    FOREIGN KEY (well_id) REFERENCES gwb_msstamm(id);
--
-- Definition for index gwb_surfacewaters_pk (OID = 41276) : 
--
ALTER TABLE ONLY gwb_surfacewaters
    ADD CONSTRAINT gwb_surfacewaters_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_surfacewater_parts_pk (OID = 41282) : 
--
ALTER TABLE ONLY gwb_surfacewater_parts
    ADD CONSTRAINT gwb_surfacewater_parts_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_swparts_mainsw_fk (OID = 41285) : 
--
ALTER TABLE ONLY gwb_surfacewater_parts
    ADD CONSTRAINT gwb_swparts_mainsw_fk
    FOREIGN KEY (main_id) REFERENCES gwb_surfacewaters(id) ON DELETE CASCADE;
--
-- Definition for index gwb_param_valueclasses_pk (OID = 41293) : 
--
ALTER TABLE ONLY gwb_param_valueclasses
    ADD CONSTRAINT gwb_param_valueclasses_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_pvc_param_fk (OID = 41295) : 
--
ALTER TABLE ONLY gwb_param_valueclasses
    ADD CONSTRAINT gwb_pvc_param_fk
    FOREIGN KEY (param_id) REFERENCES gwb_paramet(id) ON DELETE CASCADE;
--
-- Definition for index pk_db_version_ (OID = 41304) : 
--
ALTER TABLE ONLY db_version_
    ADD CONSTRAINT pk_db_version_
    PRIMARY KEY (module_id);
--
-- Definition for index pk_rst_appconfig (OID = 64406) : 
--
ALTER TABLE ONLY rst_appconfig
    ADD CONSTRAINT pk_rst_appconfig
    PRIMARY KEY (mandant_id, module_id, key_);
--
-- Definition for index pk_rst_dbversion (OID = 64411) : 
--
ALTER TABLE ONLY rst_dbversion
    ADD CONSTRAINT pk_rst_dbversion
    PRIMARY KEY (mandant_id, module_id);
--
-- Definition for index gwb_wellstdtodocategories_pk (OID = 64416) : 
--
SET search_path = public, pg_catalog;
ALTER TABLE ONLY gwb_wellstdtodocategories
    ADD CONSTRAINT gwb_wellstdtodocategories_pk
    PRIMARY KEY (well_id, category_id);
--
-- Definition for index gwb_wellstdtodocategories_pk (OID = 64421) : 
--
SET search_path = gwbase, pg_catalog;
ALTER TABLE ONLY gwb_wellstdtodocategories
    ADD CONSTRAINT gwb_wellstdtodocategories_pk
    PRIMARY KEY (well_id, category_id);
--
-- Definition for index gwb_stationreports_pk (OID = 64670) : 
--
ALTER TABLE ONLY gwb_stationreports
    ADD CONSTRAINT gwb_stationreports_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wellproperties_values_pk (OID = 64675) : 
--
ALTER TABLE ONLY gwb_wellproperties_values
    ADD CONSTRAINT gwb_wellproperties_values_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_wpvalues_property_fk (OID = 64677) : 
--
ALTER TABLE ONLY gwb_wellproperties_values
    ADD CONSTRAINT gwb_wpvalues_property_fk
    FOREIGN KEY (property_id) REFERENCES gwb_wellproperties(id) ON DELETE CASCADE;
--
-- Definition for index gwb_techequip_manufacturercat_pk (OID = 64685) : 
--
ALTER TABLE ONLY gwb_techequip_manufacturercat
    ADD CONSTRAINT gwb_techequip_manufacturercat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_techequip_typecat_pk (OID = 64690) : 
--
ALTER TABLE ONLY gwb_techequip_typecat
    ADD CONSTRAINT gwb_techequip_typecat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwm_picturecategoriescat_pk (OID = 64703) : 
--
ALTER TABLE ONLY gwm_picturecategoriescat
    ADD CONSTRAINT gwm_picturecategoriescat_pk
    PRIMARY KEY (id);
--
-- Definition for index gwb_fieldchecks_pk (OID = 64708) : 
--
ALTER TABLE ONLY gwb_fieldchecks
    ADD CONSTRAINT gwb_fieldchecks_pk
    PRIMARY KEY (tname, fname);
--
-- Definition for index gwb_streetcat_pk (OID = 64723) : 
--
ALTER TABLE ONLY gwb_streetcat
    ADD CONSTRAINT gwb_streetcat_pk
    PRIMARY KEY (streetkey);
--
-- Definition for index gwb_logins_pk (OID = 64741) : 
--
ALTER TABLE ONLY gwb_logins
    ADD CONSTRAINT gwb_logins_pk
    PRIMARY KEY (user_id, logintime);
--
-- Definition for index gwb_sampleweather_pk (OID = 69058) : 
--
ALTER TABLE ONLY gwb_sampleweather
    ADD CONSTRAINT gwb_sampleweather_pk
    PRIMARY KEY (weather);
--
-- Definition for index gwb_sampleturbidity_pk (OID = 69060) : 
--
ALTER TABLE ONLY gwb_sampleturbidity
    ADD CONSTRAINT gwb_sampleturbidity_pk
    PRIMARY KEY (turbidity);
--
-- Definition for index gwb_samplesediment_pk (OID = 69062) : 
--
ALTER TABLE ONLY gwb_samplesediment
    ADD CONSTRAINT gwb_samplesediment_pk
    PRIMARY KEY (sediment);
--
-- Definition for index gwb_samplesmell_pk (OID = 69064) : 
--
ALTER TABLE ONLY gwb_samplesmell
    ADD CONSTRAINT gwb_samplesmell_pk
    PRIMARY KEY (smell);
--
-- Definition for index gwb_sampletype_pk (OID = 69066) : 
--
ALTER TABLE ONLY gwb_sampletype
    ADD CONSTRAINT gwb_sampletype_pk
    PRIMARY KEY (sampletype);
--
-- Definition for index gwb_import_pk (OID = 69068) : 
--
ALTER TABLE ONLY gwb_imports
    ADD CONSTRAINT gwb_import_pk
    PRIMARY KEY (id);
--
-- Comments
--
COMMENT ON SCHEMA public IS 'standard public schema';
