[Lada-commits] [PATCH 1 of 2] Updated database schema
Wald Commits
scm-commit at wald.intevation.org
Wed Dec 2 14:07:24 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1449061608 -3600
# Node ID 2b0d99fbeecc6678d9b2eb4aa8d6b885d3e6ad88
# Parent fee42d7b2f330780fb6b25e6b89ae9eadca10e6f
Updated database schema.
Added tables for probenehmer, datensatz_erzeuger, messprogramm_kategorie.
Updated table ort.
diff -r fee42d7b2f33 -r 2b0d99fbeecc db_schema/lada_schema.sql
--- a/db_schema/lada_schema.sql Wed Nov 25 13:35:12 2015 +0100
+++ b/db_schema/lada_schema.sql Wed Dec 02 14:06:48 2015 +0100
@@ -430,24 +430,24 @@
--
--- Name: ort; Type: TABLE; Schema: bund; Owner: -; Tablespace:
---
-
-CREATE TABLE ort (
+-- Name: ortszuordnung; Type: TABLE; Schema: bund; Owner: -; Tablespace:
+--
+
+CREATE TABLE ortszuordnung (
id integer DEFAULT nextval('ort_id_seq'::regclass) NOT NULL,
probe_id integer NOT NULL,
ort_id bigint NOT NULL,
- orts_typ character varying(1),
+ ortszuordnung_typ character varying(1),
ortszusatztext character varying(100),
letzte_aenderung timestamp without time zone DEFAULT now()
);
--
--- Name: COLUMN ort.orts_typ; Type: COMMENT; Schema: bund; Owner: -
---
-
-COMMENT ON COLUMN ort.orts_typ IS 'E = Entnahmeport, U = Ursprungsort, Z = Ortszusatz';
+-- Name: COLUMN ortszuordnung.ortszuordnung_typ; Type: COMMENT; Schema: bund; Owner: -
+--
+
+COMMENT ON COLUMN ortszuordnung.ortszuordnung_typ IS 'E = Entnahmeport, U = Ursprungsort, Z = Ortszusatz';
--
@@ -766,13 +766,13 @@
--
--- Name: ort; Type: TABLE; Schema: land; Owner: -; Tablespace:
---
-
-CREATE TABLE ort (
+-- Name: ortszuordnung; Type: TABLE; Schema: land; Owner: -; Tablespace:
+--
+
+CREATE TABLE ortszuordnung (
tree_modified timestamp without time zone DEFAULT now()
)
-INHERITS (bund.ort);
+INHERITS (bund.ortszuordnung);
--
@@ -966,6 +966,39 @@
--
+-- Name: datensatz_erzeuger; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+CREATE TABLE datensatz_erzeuger (
+ id integer NOT NULL,
+ netzbetreiber_id character varying(2),
+ da_erzeuger_id character varying(2),
+ mst_id character varying(5),
+ bezeichnung character varying(120),
+ letzte_aenderung timestamp without time zone
+);
+
+
+--
+-- Name: datensatz_erzeuger_id_seq; Type: SEQUENCE; Schema: stammdaten; Owner: -
+--
+
+CREATE SEQUENCE datensatz_erzeuger_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: datensatz_erzeuger_id_seq; Type: SEQUENCE OWNED BY; Schema: stammdaten; Owner: -
+--
+
+ALTER SEQUENCE datensatz_erzeuger_id_seq OWNED BY datensatz_erzeuger.id;
+
+
+--
-- Name: de_vg; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
--
@@ -1219,6 +1252,38 @@
--
+-- Name: messprogramm_kategorie; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+CREATE TABLE messprogramm_kategorie (
+ id integer NOT NULL,
+ netzbetreiber_id character varying(2),
+ mpl_id character varying(3),
+ bezeichnung character varying(120),
+ letzte_aenderung timestamp without time zone
+);
+
+
+--
+-- Name: messprogramm_kategorie_id_seq; Type: SEQUENCE; Schema: stammdaten; Owner: -
+--
+
+CREATE SEQUENCE messprogramm_kategorie_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: messprogramm_kategorie_id_seq; Type: SEQUENCE OWNED BY; Schema: stammdaten; Owner: -
+--
+
+ALTER SEQUENCE messprogramm_kategorie_id_seq OWNED BY messprogramm_kategorie.id;
+
+
+--
-- Name: mg_grp; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
--
@@ -1271,10 +1336,9 @@
CREATE TABLE ort (
id integer NOT NULL,
- o_typ character varying(1),
netzbetreiber_id character varying(2),
- bezeichnung character varying(10),
- beschreibung character varying(100),
+ ort_id character varying(10),
+ langtext character varying(100),
staat_id smallint,
gem_id character varying(8),
unscharf character(1) DEFAULT NULL::bpchar,
@@ -1287,22 +1351,21 @@
latitude double precision,
longitude double precision,
geom public.geometry(Point,4326),
- shape public.geometry(MultiPolygon,4326)
+ shape public.geometry(MultiPolygon,4326),
+ ort_typ smallint,
+ kurztext character varying(15),
+ berichtstext character varying(70),
+ zone character varying(1),
+ sektor character varying(2),
+ zustaendigkeit character varying(10),
+ mp_art character varying(10),
+ aktiv character(1),
+ anlage_id integer,
+ oz_id integer
);
--
--- Name: COLUMN ort.o_typ; Type: COMMENT; Schema: stammdaten; Owner: -
---
-
-COMMENT ON COLUMN ort.o_typ IS 'D = dynamischer Messpunkt (nicht vordefiniert)
-V = vordefinierter Messpunkt
-R = REI-Messpunkt
-S = Station
-Z = Ortzszusatz';
-
-
---
-- Name: ort_id_seq; Type: SEQUENCE; Schema: stammdaten; Owner: -
--
@@ -1322,6 +1385,26 @@
--
+-- Name: ort_typ; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+CREATE TABLE ort_typ (
+ id smallint NOT NULL,
+ ort_typ character varying(60)
+);
+
+
+--
+-- Name: ortszuordnung_typ; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+CREATE TABLE ortszuordnung_typ (
+ id character(1) NOT NULL,
+ ortstyp character varying(60)
+);
+
+
+--
-- Name: pflicht_messgroesse; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
--
@@ -1398,6 +1481,48 @@
--
+-- Name: probenehmer; Type: TABLE; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+CREATE TABLE probenehmer (
+ id integer NOT NULL,
+ netzbetreiber_id character varying(2),
+ prn_id character varying(9),
+ bearbeiter character varying(25),
+ bemerkung character varying(60),
+ betrieb character varying(80),
+ bezeichnung character varying(80),
+ kurz_bezeichnung character varying(10),
+ ort character varying(20),
+ plz character varying(5),
+ strasse character varying(30),
+ telefon character varying(20),
+ tp character varying(3),
+ typ character(1),
+ letzte_aenderung timestamp without time zone
+);
+
+
+--
+-- Name: probenehmer_id_seq; Type: SEQUENCE; Schema: stammdaten; Owner: -
+--
+
+CREATE SEQUENCE probenehmer_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: probenehmer_id_seq; Type: SEQUENCE OWNED BY; Schema: stammdaten; Owner: -
+--
+
+ALTER SEQUENCE probenehmer_id_seq OWNED BY probenehmer.id;
+
+
+--
-- Name: s_00_view; Type: VIEW; Schema: stammdaten; Owner: -
--
@@ -1991,14 +2116,14 @@
-- Name: id; Type: DEFAULT; Schema: land; Owner: -
--
-ALTER TABLE ONLY ort ALTER COLUMN id SET DEFAULT nextval('bund.ort_id_seq'::regclass);
+ALTER TABLE ONLY ortszuordnung ALTER COLUMN id SET DEFAULT nextval('bund.ort_id_seq'::regclass);
--
-- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
--
-ALTER TABLE ONLY ort ALTER COLUMN letzte_aenderung SET DEFAULT now();
+ALTER TABLE ONLY ortszuordnung ALTER COLUMN letzte_aenderung SET DEFAULT now();
--
@@ -2084,6 +2209,13 @@
-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
--
+ALTER TABLE ONLY datensatz_erzeuger ALTER COLUMN id SET DEFAULT nextval('datensatz_erzeuger_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
+--
+
ALTER TABLE ONLY de_vg ALTER COLUMN id SET DEFAULT nextval('de_vg_id_seq'::regclass);
@@ -2126,6 +2258,13 @@
-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
--
+ALTER TABLE ONLY messprogramm_kategorie ALTER COLUMN id SET DEFAULT nextval('messprogramm_kategorie_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
+--
+
ALTER TABLE ONLY ort ALTER COLUMN id SET DEFAULT nextval('ort_id_seq'::regclass);
@@ -2147,6 +2286,13 @@
-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
--
+ALTER TABLE ONLY probenehmer ALTER COLUMN id SET DEFAULT nextval('probenehmer_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: stammdaten; Owner: -
+--
+
ALTER TABLE ONLY staat ALTER COLUMN id SET DEFAULT nextval('staat_id_seq'::regclass);
@@ -2193,7 +2339,315 @@
--
--- Name: ort_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+-- Name: ortszuordnung_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: probe_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY probe
+ ADD CONSTRAINT probe_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: status_protokoll_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY status_protokoll
+ ADD CONSTRAINT status_protokoll_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: zusatz_wert_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY zusatz_wert
+ ADD CONSTRAINT zusatz_wert_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY zusatz_wert
+ ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id);
+
+
+SET search_path = land, pg_catalog;
+
+--
+-- Name: kommentar_m_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY kommentar_m
+ ADD CONSTRAINT kommentar_m_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: kommentar_p_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY kommentar_p
+ ADD CONSTRAINT kommentar_p_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messprogramm_mmt_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messprogramm_mmt
+ ADD CONSTRAINT messprogramm_mmt_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messprogramm_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messprogramm
+ ADD CONSTRAINT messprogramm_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messung
+ ADD CONSTRAINT messung_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messung_translation_messungs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messung_translation
+ ADD CONSTRAINT messung_translation_messungs_id_key UNIQUE (messungs_id);
+
+
+--
+-- Name: messung_translation_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messung_translation
+ ADD CONSTRAINT messung_translation_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messwert_messungs_id_messgroesse_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messwert
+ ADD CONSTRAINT messwert_messungs_id_messgroesse_id_key UNIQUE (messungs_id, messgroesse_id);
+
+
+--
+-- Name: messwert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messwert
+ ADD CONSTRAINT messwert_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ortszuordnung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: probe_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY probe
+ ADD CONSTRAINT probe_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: probe_translation_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY probe_translation
+ ADD CONSTRAINT probe_translation_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: probe_translation_probe_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY probe_translation
+ ADD CONSTRAINT probe_translation_probe_id_key UNIQUE (probe_id);
+
+
+--
+-- Name: status_protokoll_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY status_protokoll
+ ADD CONSTRAINT status_protokoll_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: zusatz_wert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY zusatz_wert
+ ADD CONSTRAINT zusatz_wert_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY zusatz_wert
+ ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id);
+
+
+SET search_path = stammdaten, pg_catalog;
+
+--
+-- Name: auth_lst_umw_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY auth_lst_umw
+ ADD CONSTRAINT auth_lst_umw_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: auth_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY auth
+ ADD CONSTRAINT auth_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: auth_role_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY auth_funktion
+ ADD CONSTRAINT auth_role_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: datenbasis_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY datenbasis
+ ADD CONSTRAINT datenbasis_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: datensatz_erzeuger_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY datensatz_erzeuger
+ ADD CONSTRAINT datensatz_erzeuger_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: de_vg_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY de_vg
+ ADD CONSTRAINT de_vg_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: deskriptor_umwelt_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY deskriptor_umwelt
+ ADD CONSTRAINT deskriptor_umwelt_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: koordinaten_art_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY koordinaten_art
+ ADD CONSTRAINT koordinaten_art_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mess_einheit_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mess_einheit
+ ADD CONSTRAINT mess_einheit_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mess_methode_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mess_methode
+ ADD CONSTRAINT mess_methode_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mess_stelle_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mess_stelle
+ ADD CONSTRAINT mess_stelle_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messgroesse_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messgroesse
+ ADD CONSTRAINT messgroesse_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messgroessen_gruppe_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messgroessen_gruppe
+ ADD CONSTRAINT messgroessen_gruppe_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: messprogramm_kategorie_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY messprogramm_kategorie
+ ADD CONSTRAINT messprogramm_kategorie_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mg_grp_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mg_grp
+ ADD CONSTRAINT mg_grp_pkey PRIMARY KEY (messgroessengruppe_id, messgroesse_id);
+
+
+--
+-- Name: mmt_messgroesse_grp_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mmt_messgroesse_grp
+ ADD CONSTRAINT mmt_messgroesse_grp_pkey PRIMARY KEY (messgroessengruppe_id, mmt_id);
+
+
+--
+-- Name: netz_betreiber_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY netz_betreiber
+ ADD CONSTRAINT netz_betreiber_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ort_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
--
ALTER TABLE ONLY ort
@@ -2201,295 +2655,19 @@
--
--- Name: probe_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY probe
- ADD CONSTRAINT probe_pkey PRIMARY KEY (id);
-
-
---
--- Name: status_protokoll_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY status_protokoll
- ADD CONSTRAINT status_protokoll_pkey PRIMARY KEY (id);
-
-
---
--- Name: zusatz_wert_pkey; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY zusatz_wert
- ADD CONSTRAINT zusatz_wert_pkey PRIMARY KEY (id);
-
-
---
--- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: bund; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY zusatz_wert
- ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id);
-
-
-SET search_path = land, pg_catalog;
-
---
--- Name: kommentar_m_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY kommentar_m
- ADD CONSTRAINT kommentar_m_pkey PRIMARY KEY (id);
-
-
---
--- Name: kommentar_p_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY kommentar_p
- ADD CONSTRAINT kommentar_p_pkey PRIMARY KEY (id);
-
-
---
--- Name: messprogramm_mmt_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messprogramm_mmt
- ADD CONSTRAINT messprogramm_mmt_pkey PRIMARY KEY (id);
-
-
---
--- Name: messprogramm_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messprogramm
- ADD CONSTRAINT messprogramm_pkey PRIMARY KEY (id);
-
-
---
--- Name: messung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messung
- ADD CONSTRAINT messung_pkey PRIMARY KEY (id);
-
-
---
--- Name: messung_translation_messungs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messung_translation
- ADD CONSTRAINT messung_translation_messungs_id_key UNIQUE (messungs_id);
-
-
---
--- Name: messung_translation_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messung_translation
- ADD CONSTRAINT messung_translation_pkey PRIMARY KEY (id);
-
-
---
--- Name: messwert_messungs_id_messgroesse_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messwert
- ADD CONSTRAINT messwert_messungs_id_messgroesse_id_key UNIQUE (messungs_id, messgroesse_id);
-
-
---
--- Name: messwert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messwert
- ADD CONSTRAINT messwert_pkey PRIMARY KEY (id);
-
-
---
--- Name: ort_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_pkey PRIMARY KEY (id);
-
-
---
--- Name: probe_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY probe
- ADD CONSTRAINT probe_pkey PRIMARY KEY (id);
-
-
---
--- Name: probe_translation_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY probe_translation
- ADD CONSTRAINT probe_translation_pkey PRIMARY KEY (id);
-
-
---
--- Name: probe_translation_probe_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY probe_translation
- ADD CONSTRAINT probe_translation_probe_id_key UNIQUE (probe_id);
-
-
---
--- Name: status_protokoll_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY status_protokoll
- ADD CONSTRAINT status_protokoll_pkey PRIMARY KEY (id);
-
-
---
--- Name: zusatz_wert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY zusatz_wert
- ADD CONSTRAINT zusatz_wert_pkey PRIMARY KEY (id);
-
-
---
--- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY zusatz_wert
- ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id);
-
-
-SET search_path = stammdaten, pg_catalog;
-
---
--- Name: auth_lst_umw_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY auth_lst_umw
- ADD CONSTRAINT auth_lst_umw_pkey PRIMARY KEY (id);
-
-
---
--- Name: auth_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY auth
- ADD CONSTRAINT auth_pkey PRIMARY KEY (id);
-
-
---
--- Name: auth_role_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY auth_funktion
- ADD CONSTRAINT auth_role_pkey PRIMARY KEY (id);
-
-
---
--- Name: datenbasis_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY datenbasis
- ADD CONSTRAINT datenbasis_pkey PRIMARY KEY (id);
-
-
---
--- Name: de_vg_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY de_vg
- ADD CONSTRAINT de_vg_pkey PRIMARY KEY (id);
-
-
---
--- Name: deskriptor_umwelt_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY deskriptor_umwelt
- ADD CONSTRAINT deskriptor_umwelt_pkey PRIMARY KEY (id);
-
-
---
--- Name: koordinaten_art_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY koordinaten_art
- ADD CONSTRAINT koordinaten_art_pkey PRIMARY KEY (id);
-
-
---
--- Name: mess_einheit_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY mess_einheit
- ADD CONSTRAINT mess_einheit_pkey PRIMARY KEY (id);
-
-
---
--- Name: mess_methode_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY mess_methode
- ADD CONSTRAINT mess_methode_pkey PRIMARY KEY (id);
-
-
---
--- Name: mess_stelle_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY mess_stelle
- ADD CONSTRAINT mess_stelle_pkey PRIMARY KEY (id);
-
-
---
--- Name: messgroesse_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messgroesse
- ADD CONSTRAINT messgroesse_pkey PRIMARY KEY (id);
-
-
---
--- Name: messgroessen_gruppe_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY messgroessen_gruppe
- ADD CONSTRAINT messgroessen_gruppe_pkey PRIMARY KEY (id);
-
-
---
--- Name: mg_grp_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY mg_grp
- ADD CONSTRAINT mg_grp_pkey PRIMARY KEY (messgroessengruppe_id, messgroesse_id);
-
-
---
--- Name: mmt_messgroesse_grp_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY mmt_messgroesse_grp
- ADD CONSTRAINT mmt_messgroesse_grp_pkey PRIMARY KEY (messgroessengruppe_id, mmt_id);
-
-
---
--- Name: netz_betreiber_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY netz_betreiber
- ADD CONSTRAINT netz_betreiber_pkey PRIMARY KEY (id);
-
-
---
--- Name: ort_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_pkey PRIMARY KEY (id);
+-- Name: ort_typ_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY ort_typ
+ ADD CONSTRAINT ort_typ_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ortszuordnung_typ_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY ortszuordnung_typ
+ ADD CONSTRAINT ortszuordnung_typ_pkey PRIMARY KEY (id);
--
@@ -2533,6 +2711,14 @@
--
+-- Name: probenehmer_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY probenehmer
+ ADD CONSTRAINT probenehmer_pkey PRIMARY KEY (id);
+
+
+--
-- Name: staat_pkey; Type: CONSTRAINT; Schema: stammdaten; Owner: -; Tablespace:
--
@@ -2694,7 +2880,7 @@
-- Name: tree_timestamp_ort; Type: TRIGGER; Schema: land; Owner: -
--
-CREATE TRIGGER tree_timestamp_ort BEFORE UPDATE ON ort FOR EACH ROW EXECUTE PROCEDURE update_time_ort();
+CREATE TRIGGER tree_timestamp_ort BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_time_ort();
--
@@ -2778,19 +2964,27 @@
--
--- Name: ort_ort_id_fkey; Type: FK CONSTRAINT; Schema: bund; Owner: -
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id);
-
-
---
--- Name: ort_probe_id_fkey; Type: FK CONSTRAINT; Schema: bund; Owner: -
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id);
+-- Name: ortszuordnung_ort_id_fkey; Type: FK CONSTRAINT; Schema: bund; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id);
+
+
+--
+-- Name: ortszuordnung_ortszuordnung_typ_fkey; Type: FK CONSTRAINT; Schema: bund; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_ortszuordnung_typ_fkey FOREIGN KEY (ortszuordnung_typ) REFERENCES stammdaten.ortszuordnung_typ(id);
+
+
+--
+-- Name: ortszuordnung_probe_id_fkey; Type: FK CONSTRAINT; Schema: bund; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id);
--
@@ -3012,19 +3206,27 @@
--
--- Name: ort_ort_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id);
-
-
---
--- Name: ort_probe_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY ort
- ADD CONSTRAINT ort_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id) ON DELETE CASCADE;
+-- Name: ortszuordnung_ort_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id);
+
+
+--
+-- Name: ortszuordnung_ortszuordnung_typ_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_ortszuordnung_typ_fkey FOREIGN KEY (ortszuordnung_typ) REFERENCES stammdaten.ortszuordnung_typ(id);
+
+
+--
+-- Name: ortszuordnung_probe_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung
+ ADD CONSTRAINT ortszuordnung_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id) ON DELETE CASCADE;
--
@@ -3150,6 +3352,22 @@
--
+-- Name: datensatz_erzeuger_mst_id_fkey1; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY datensatz_erzeuger
+ ADD CONSTRAINT datensatz_erzeuger_mst_id_fkey1 FOREIGN KEY (mst_id) REFERENCES mess_stelle(id);
+
+
+--
+-- Name: datensatz_erzeuger_netzbetreiber_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY datensatz_erzeuger
+ ADD CONSTRAINT datensatz_erzeuger_netzbetreiber_id_fkey FOREIGN KEY (netzbetreiber_id) REFERENCES netz_betreiber(id);
+
+
+--
-- Name: fk_deskriptoren_vorgaenger; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
--
@@ -3158,6 +3376,22 @@
--
+-- Name: messprogramm_kategorie_netzbetreiber_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY messprogramm_kategorie
+ ADD CONSTRAINT messprogramm_kategorie_netzbetreiber_id_fkey FOREIGN KEY (netzbetreiber_id) REFERENCES netz_betreiber(id);
+
+
+--
+-- Name: ort_anlage_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY ort
+ ADD CONSTRAINT ort_anlage_fkey FOREIGN KEY (anlage_id) REFERENCES ort(id);
+
+
+--
-- Name: ort_gem_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
--
@@ -3182,6 +3416,22 @@
--
+-- Name: ort_ort_typ_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY ort
+ ADD CONSTRAINT ort_ort_typ_fkey FOREIGN KEY (ort_typ) REFERENCES ort_typ(id);
+
+
+--
+-- Name: ort_oz_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY ort
+ ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id);
+
+
+--
-- Name: ort_staat_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
--
@@ -3222,6 +3472,14 @@
--
+-- Name: probenehmer_netzbetreiber_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
+--
+
+ALTER TABLE ONLY probenehmer
+ ADD CONSTRAINT probenehmer_netzbetreiber_id_fkey FOREIGN KEY (netzbetreiber_id) REFERENCES netz_betreiber(id);
+
+
+--
-- Name: staat_kda_id_fkey; Type: FK CONSTRAINT; Schema: stammdaten; Owner: -
--
More information about the Lada-commits
mailing list