[Lada-commits] [PATCH 04 of 12] Added FK constraints

Wald Commits scm-commit at wald.intevation.org
Mon Jul 4 12:09:10 CEST 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1467619208 -7200
# Branch schema-update
# Node ID f0ac901a4387a560f97bd8347a3cf7809474d01c
# Parent  17e9d1b2d471070c7eaa9608331bd2c09dd34310
Added FK constraints.

diff -r 17e9d1b2d471 -r f0ac901a4387 db_schema/lada_schema.sql
--- 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,


More information about the Lada-commits mailing list