diff db_schema/lada_schema.sql @ 900:26d57ae6dd2f

Improve readability of DDL for messprogramm table.
author Tom Gottfried <tom@intevation.de>
date Wed, 23 Mar 2016 13:07:11 +0100
parents 4bbfc9cff5d7
children 56c9fb1d37c8
line wrap: on
line diff
--- a/db_schema/lada_schema.sql	Wed Mar 23 12:47:16 2016 +0100
+++ b/db_schema/lada_schema.sql	Wed Mar 23 13:07:11 2016 +0100
@@ -521,43 +521,6 @@
 
 
 --
--- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace:
---
-
-CREATE TABLE messprogramm (
-    id integer NOT NULL,
-    name character varying(256),
-    test boolean DEFAULT false NOT NULL,
-    netzbetreiber_id character varying(2) NOT NULL,
-    mst_id character varying(5) NOT NULL,
-    labor_mst_id character varying(5),
-    datenbasis_id integer NOT NULL,
-    ba_id character varying(1),
-    gem_id character varying(8),
-    ort_id integer,
-    media_desk character varying(100),
-    umw_id character varying(3),
-    probenart_id integer NOT NULL,
-    probenintervall character varying(2),
-    teilintervall_von integer,
-    teilintervall_bis integer,
-    intervall_offset integer,
-    gueltig_von integer,
-    gueltig_bis integer,
-    probe_nehmer_id integer,
-    probe_kommentar character varying(80),
-    letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL
-);
-
-
---
--- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: -
---
-
-COMMENT ON COLUMN messprogramm.media_desk IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)';
-
-
---
 -- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: -
 --
 
@@ -570,6 +533,36 @@
 
 
 --
+-- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace:
+--
+
+CREATE TABLE messprogramm (
+    id integer PRIMARY KEY DEFAULT nextval('messprogramm_id_seq'::regclass),
+    name character varying(256),
+    test boolean DEFAULT false NOT NULL,
+    netzbetreiber_id character varying(2) NOT NULL
+        REFERENCES stammdaten.netz_betreiber,
+    mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
+    labor_mst_id character varying(5) REFERENCES stammdaten.mess_stelle,
+    datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis,
+    ba_id character varying(1),
+    gem_id character varying(8),
+    ort_id integer REFERENCES stammdaten.ort,
+    media_desk character varying(100),
+    umw_id character varying(3) REFERENCES stammdaten.umwelt,
+    probenart_id integer NOT NULL REFERENCES stammdaten.probenart,
+    probenintervall character varying(2),
+    teilintervall_von integer,
+    teilintervall_bis integer,
+    intervall_offset integer,
+    gueltig_von integer,
+    gueltig_bis integer,
+    probe_nehmer_id integer,
+    probe_kommentar character varying(80),
+    letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL
+);
+
+--
 -- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: -
 --
 
@@ -577,6 +570,13 @@
 
 
 --
+-- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: -
+--
+
+COMMENT ON COLUMN messprogramm.media_desk IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)';
+
+
+--
 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace:
 --
 
@@ -847,13 +847,6 @@
 -- Name: id; Type: DEFAULT; Schema: land; Owner: -
 --
 
-ALTER TABLE ONLY messprogramm ALTER COLUMN id SET DEFAULT nextval('messprogramm_id_seq'::regclass);
-
-
---
--- Name: id; Type: DEFAULT; Schema: land; Owner: -
---
-
 ALTER TABLE ONLY messprogramm_mmt ALTER COLUMN id SET DEFAULT nextval('messprogramm_mmt_id_seq'::regclass);
 
 
@@ -1063,14 +1056,6 @@
 
 
 --
--- 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:
 --
 
@@ -1398,14 +1383,6 @@
 
 
 --
--- Name: messprogramm_datenbasis_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_datenbasis_id_fkey FOREIGN KEY (datenbasis_id) REFERENCES stammdaten.datenbasis(id);
-
-
---
 -- Name: messprogramm_mmt_messprogramm_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
 --
 
@@ -1422,46 +1399,6 @@
 
 
 --
--- Name: messprogramm_mst_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_mst_id_fkey FOREIGN KEY (mst_id) REFERENCES stammdaten.mess_stelle(id);
-
-
---
--- Name: messprogramm_netzbetreiber_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_netzbetreiber_id_fkey FOREIGN KEY (netzbetreiber_id) REFERENCES stammdaten.netz_betreiber(id);
-
-
---
--- Name: messprogramm_ort_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id);
-
-
---
--- Name: messprogramm_probenart_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_probenart_id_fkey FOREIGN KEY (probenart_id) REFERENCES stammdaten.probenart(id);
-
-
---
--- Name: messprogramm_umw_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messprogramm
-    ADD CONSTRAINT messprogramm_umw_id_fkey FOREIGN KEY (umw_id) REFERENCES stammdaten.umwelt(id);
-
-
---
 -- Name: messung_mmt_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: -
 --
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)