diff db_schema/stammdaten_schema.sql @ 1093:effef57f3f7e 2.3.0

Complement and correct data model and docs for queries.
author Tom Gottfried <tom@intevation.de>
date Fri, 14 Oct 2016 15:18:42 +0200
parents 299f4ba86090
children 186d602e031a
line wrap: on
line diff
--- a/db_schema/stammdaten_schema.sql	Thu Oct 13 22:25:46 2016 +0200
+++ b/db_schema/stammdaten_schema.sql	Fri Oct 14 15:18:42 2016 +0200
@@ -295,9 +295,12 @@
 CREATE TABLE query (
     id integer PRIMARY KEY DEFAULT nextval('query_id_seq'::regclass),
     name character varying(80) NOT NULL,
-    type character varying(30) NOT NULL,
+    type character varying(30) NOT NULL
+        CHECK(type IN('probe', 'messung', 'messprogramm', 'ort',
+            'probenehmer', 'datensatzerzeuger', 'messprogrammkategorie')),
     sql character varying(1500) NOT NULL,
-    description character varying(100)
+    description character varying(100),
+    UNIQUE (name, type)
 );
 
 ALTER SEQUENCE query_id_seq OWNED BY query.id;
@@ -330,7 +333,8 @@
     id integer PRIMARY KEY DEFAULT nextval('filter_id_seq'::regclass),
     query_id integer NOT NULL REFERENCES query ON DELETE CASCADE,
     data_index character varying(50) NOT NULL,
-    type character varying(10) NOT NULL,
+    type character varying(10) NOT NULL
+        CHECK(type IN('liststatus', 'listmst', 'listnetz', 'listumw', 'text')),
     label character varying(50) NOT NULL,
     multiselect boolean
 );
@@ -625,7 +629,8 @@
     header character varying(50) NOT NULL,
     width integer,
     flex boolean,
-    index integer,
+    index integer NOT NULL,
+    UNIQUE (query_id, index),
     UNIQUE (query_id, data_index)
 );
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)