[Lada-commits] [PATCH 2 of 2] Improve readability of DDL for messprogramm table

Wald Commits scm-commit at wald.intevation.org
Wed Mar 23 13:07:59 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1458734831 -3600
# Node ID 26d57ae6dd2f7c5482acce50699aef51b8aee3c4
# Parent  4bbfc9cff5d774537a3544349d5c846539793c08
Improve readability of DDL for messprogramm table.

diff -r 4bbfc9cff5d7 -r 26d57ae6dd2f db_schema/lada_schema.sql
--- 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,23 +521,36 @@
 
 
 --
+-- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: -
+--
+
+CREATE SEQUENCE messprogramm_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
 -- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace:
 --
 
 CREATE TABLE messprogramm (
-    id integer NOT NULL,
+    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,
-    mst_id character varying(5) NOT NULL,
-    labor_mst_id character varying(5),
-    datenbasis_id integer 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,
+    ort_id integer REFERENCES stammdaten.ort,
     media_desk character varying(100),
-    umw_id character varying(3),
-    probenart_id integer NOT NULL,
+    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,
@@ -549,6 +562,12 @@
     letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL
 );
 
+--
+-- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: -
+--
+
+ALTER SEQUENCE messprogramm_id_seq OWNED BY messprogramm.id;
+
 
 --
 -- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: -
@@ -558,25 +577,6 @@
 
 
 --
--- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: -
---
-
-CREATE SEQUENCE messprogramm_id_seq
-    START WITH 1
-    INCREMENT BY 1
-    NO MINVALUE
-    NO MAXVALUE
-    CACHE 1;
-
-
---
--- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: -
---
-
-ALTER SEQUENCE messprogramm_id_seq OWNED BY messprogramm.id;
-
-
---
 -- 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: -
 --
 


More information about the Lada-commits mailing list