diff db_schema/lada_schema.sql @ 1009:f0ac901a4387 schema-update

Added FK constraints.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 04 Jul 2016 10:00:08 +0200
parents 17e9d1b2d471
children c1e00e1fe5c8
line wrap: on
line diff
--- a/db_schema/lada_schema.sql	Mon Jul 04 08:55:36 2016 +0200
+++ b/db_schema/lada_schema.sql	Mon Jul 04 10:00:08 2016 +0200
@@ -120,7 +120,7 @@
     labor_mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
     datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis,
     ba_id character varying(1),
-    gem_id character varying(8),
+    gem_id character varying(8) REFERENCES stammdaten.verwaltungseinheit,
     ort_id integer NOT NULL REFERENCES stammdaten.ort,
     media_desk character varying(100),
     umw_id character varying(3) REFERENCES stammdaten.umwelt,
@@ -131,7 +131,7 @@
     intervall_offset integer,
     gueltig_von integer NOT NULL,
     gueltig_bis integer NOT NULL,
-    probe_nehmer_id integer,
+    probe_nehmer_id integer REFERENCES stammdaten.probenehmer,
     probe_kommentar character varying(80),
     letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL
 );
@@ -173,11 +173,10 @@
     probeentnahme_ende timestamp with time zone,
     mittelungsdauer bigint,
     letzte_aenderung timestamp without time zone DEFAULT now(),
-    erzeuger_id integer,
-    probe_nehmer_id integer,
-    mp_kat character(1),
-    mpl_id character varying(3),
-    mpr_id integer,
+    erzeuger_id integer REFERENCES stammdaten.datensatz_erzeuger,
+    probe_nehmer_id integer REFERENCES stammdaten.probenehmer,
+    mpl_id integer REFERENCES stammdaten.messprogramm_kategorie,
+    mpr_id integer REFERENCES messprogramm,
     solldatum_beginn timestamp without time zone,
     solldatum_ende timestamp without time zone,
     tree_modified timestamp without time zone DEFAULT now(),
@@ -193,7 +192,7 @@
 
 CREATE TABLE kommentar_p (
     id serial PRIMARY KEY,
-    mst_id character varying(5) NOT NULL,
+    mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
     datum timestamp without time zone DEFAULT now(),
     text character varying(1024),
     probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE
@@ -264,7 +263,7 @@
 
 CREATE TABLE kommentar_m (
     id serial PRIMARY KEY,
-    mst_id character varying(5) NOT NULL,
+    mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
     datum timestamp without time zone DEFAULT now(),
     text character varying(1024),
     messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE
@@ -299,7 +298,7 @@
 
 CREATE TABLE status_protokoll (
     id serial PRIMARY KEY,
-    mst_id character varying(5) NOT NULL,
+    mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
     datum timestamp without time zone DEFAULT now(),
     text character varying(1024),
     messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE,
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)