changeset 1017:dd86066d7515 schema-update

Made most constraints inline.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 04 Jul 2016 12:09:01 +0200
parents 8912b6f1776d
children 178ac8ee17c0
files db_schema/stammdaten_schema.sql
diffstat 1 files changed, 9 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/db_schema/stammdaten_schema.sql	Mon Jul 04 12:05:26 2016 +0200
+++ b/db_schema/stammdaten_schema.sql	Mon Jul 04 12:09:01 2016 +0200
@@ -106,6 +106,7 @@
     beschreibung character varying(300),
     umwelt_bereich character varying(80) NOT NULL,
     meh_id integer REFERENCES mess_einheit
+    UNIQUE (umwelt_bereich);
 );
 
 
@@ -263,6 +264,7 @@
 CREATE TABLE lada_user (
     id serial PRIMARY KEY,
     name character varying(80) NOT NULL
+    UNIQUE (name);
 );
 
 
@@ -341,12 +343,18 @@
     messgroessengruppe_id integer NOT NULL REFERENCES messgroessen_gruppe,
     messgroesse_id integer NOT NULL REFERENCES messgroesse
 );
+ALTER TABLE ONLY mg_grp
+    ADD CONSTRAINT mg_grp_pkey PRIMARY KEY (messgroessengruppe_id, messgroesse_id);
 
 
 CREATE TABLE mmt_messgroesse_grp (
     messgroessengruppe_id integer NOT NULL REFERENCES messgroessen_gruppe,
     mmt_id character varying(2) NOT NULL REFERENCES mess_methode
 );
+ALTER TABLE ONLY mmt_messgroesse_grp
+    ADD CONSTRAINT mmt_messgroesse_grp_pkey PRIMARY KEY (messgroessengruppe_id, mmt_id);
+
+
 
 
 CREATE VIEW mmt_messgroesse AS
@@ -423,6 +431,7 @@
     beschreibung character varying(50) NOT NULL,
     zusatzwert character varying(7) NOT NULL,
     eudf_keyword character varying(40)
+    UNIQUE (eudf_keyword);
 );
 
 
@@ -581,26 +590,6 @@
 -- Status workflow
 
 
-ALTER TABLE ONLY lada_user
-    ADD CONSTRAINT lada_user_name_key UNIQUE (name);
-
-
-ALTER TABLE ONLY mg_grp
-    ADD CONSTRAINT mg_grp_pkey PRIMARY KEY (messgroessengruppe_id, messgroesse_id);
-
-
-ALTER TABLE ONLY mmt_messgroesse_grp
-    ADD CONSTRAINT mmt_messgroesse_grp_pkey PRIMARY KEY (messgroessengruppe_id, mmt_id);
-
-
-ALTER TABLE ONLY proben_zusatz
-    ADD CONSTRAINT proben_zusatz_eudf_keyword_key UNIQUE (eudf_keyword);
-
-
-ALTER TABLE ONLY umwelt
-    ADD CONSTRAINT umwelt_umwelt_bereich_key UNIQUE (umwelt_bereich);
-
-
 CREATE INDEX de_vg_geom_gist ON de_vg USING gist (geom);
 
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)