annotate db_schema/lada_schema.sql @ 1007:6a313cb77fda schema-update

Renamed erzeuger to mst_id.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 04 Jul 2016 08:53:39 +0200
parents 599bd9462e62
children 17e9d1b2d471
rev   line source
797
e15c981fe310 Do not create database objects in case of erroneous definitions.
Tom Gottfried <tom@intevation.de>
parents: 792
diff changeset
1 \set ON_ERROR_STOP on
e15c981fe310 Do not create database objects in case of erroneous definitions.
Tom Gottfried <tom@intevation.de>
parents: 792
diff changeset
2
e15c981fe310 Do not create database objects in case of erroneous definitions.
Tom Gottfried <tom@intevation.de>
parents: 792
diff changeset
3 BEGIN;
e15c981fe310 Do not create database objects in case of erroneous definitions.
Tom Gottfried <tom@intevation.de>
parents: 792
diff changeset
4
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 SET statement_timeout = 0;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 SET lock_timeout = 0;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 SET client_encoding = 'UTF8';
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9 SET standard_conforming_strings = on;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 SET check_function_bodies = false;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 SET client_min_messages = warning;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 -- Name: land; Type: SCHEMA; Schema: -; Owner: -
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 CREATE SCHEMA land;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
19 SET search_path = land, pg_catalog;
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21
926
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
22 CREATE FUNCTION update_letzte_aenderung() RETURNS trigger
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
23 LANGUAGE plpgsql
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
24 AS $$
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
25 BEGIN
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
26 NEW.letzte_aenderung = now();
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
27 RETURN NEW;
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
28 END;
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
29 $$;
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30
926
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
31
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32 --
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
33 -- Name: update_time_status(); Type: FUNCTION; Schema: land; Owner: -
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
36 CREATE FUNCTION update_tree_modified() RETURNS trigger
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
37 LANGUAGE plpgsql
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
38 AS $$
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
39 BEGIN
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
40 NEW.tree_modified = now();
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
41 RETURN NEW;
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
42 END;
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
43 $$;
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
44
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
45
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
46 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
47 -- Name: update_time_messung(); Type: FUNCTION; Schema: land; Owner: -
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
48 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
49
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
50 CREATE FUNCTION update_tree_modified_messung() RETURNS trigger
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
51 LANGUAGE plpgsql
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
52 AS $$
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
53 BEGIN
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
54 RAISE NOTICE 'messung is %',NEW.id;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
55 NEW.tree_modified = now();
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
56 UPDATE land.messwert SET tree_modified = now() WHERE messungs_id = NEW.id;
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
57 UPDATE land.status_protokoll SET tree_modified = now() WHERE messungs_id = NEW.id;
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
58 RETURN NEW;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
59 END;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
60 $$;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
61
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
62
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
63 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
64 -- Name: update_time_probe(); Type: FUNCTION; Schema: land; Owner: -
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
65 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
66
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
67 CREATE FUNCTION update_tree_modified_probe() RETURNS trigger
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
68 LANGUAGE plpgsql
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
69 AS $$
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
70 BEGIN
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
71 RAISE NOTICE 'probe is %',NEW.id;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
72 NEW.tree_modified = now();
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
73 RAISE NOTICE 'updating other rows';
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
74 UPDATE land.messung SET tree_modified = now() WHERE probe_id = NEW.id;
824
6e5a0edba363 Fixed database function.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 808
diff changeset
75 UPDATE land.ortszuordnung SET tree_modified = now() WHERE probe_id = NEW.id;
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
76 UPDATE land.zusatz_wert SET tree_modified = now() WHERE probe_id = NEW.id;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
77 RETURN NEW;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
78 END;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
79 $$;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
80
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
81
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
82 SET default_tablespace = '';
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
83
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
84 SET default_with_oids = false;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
85
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
86
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
87 --
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
88 -- Name: messung_messung_id_alt_seq; Type: SEQUENCE; Schema: land; Owner: -
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
89 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
90
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
91 CREATE SEQUENCE messung_messung_id_alt_seq
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
92 START WITH 1
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
93 INCREMENT BY 1
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
94 NO MINVALUE
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
95 NO MAXVALUE
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
96 CACHE 1;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
97
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
98
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
99 --
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
100 -- Name: probe_probe_id_seq; Type: SEQUENCE; Schema: land; Owner: -
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
101 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
102
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
103 CREATE SEQUENCE probe_probe_id_seq
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
104 START WITH 1
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
105 INCREMENT BY 1
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
106 NO MINVALUE
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
107 NO MAXVALUE
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
108 CACHE 1;
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
109
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
110
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
111 --
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
112 -- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace:
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
113 --
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
114
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
115 CREATE TABLE messprogramm (
994
5886384dcb92 Replaced explicit sequences by serials.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 993
diff changeset
116 id serial PRIMARY KEY,
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
117 name character varying(256),
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
118 test boolean DEFAULT false NOT NULL,
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
119 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
1006
599bd9462e62 Removed duplicated netzbetreiber column. (mst_id already contains the
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1005
diff changeset
120 labor_mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
121 datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis,
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
122 ba_id character varying(1),
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
123 gem_id character varying(8),
989
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
124 ort_id integer NOT NULL REFERENCES stammdaten.ort,
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
125 media_desk character varying(100),
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
126 umw_id character varying(3) REFERENCES stammdaten.umwelt,
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
127 probenart_id integer NOT NULL REFERENCES stammdaten.probenart,
989
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
128 probenintervall character varying(2) NOT NULL,
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
129 teilintervall_von integer NOT NULL,
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
130 teilintervall_bis integer NOT NULL,
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
131 intervall_offset integer,
989
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
132 gueltig_von integer NOT NULL,
b943e956b767 Complement mandatory fields for messprogramm.
Tom Gottfried <tom@intevation.de>
parents: 927
diff changeset
133 gueltig_bis integer NOT NULL,
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
134 probe_nehmer_id integer,
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
135 probe_kommentar character varying(80),
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
136 letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
137 );
926
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
138 CREATE TRIGGER letzte_aenderung_messprogramm BEFORE UPDATE ON messprogramm FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
900
26d57ae6dd2f Improve readability of DDL for messprogramm table.
Tom Gottfried <tom@intevation.de>
parents: 899
diff changeset
139
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
140
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
141 --
799
2059ac26fd49 Whitespace-cleanup in schema definitions.
Tom Gottfried <tom@intevation.de>
parents: 798
diff changeset
142 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace:
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
143 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
144
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
145 CREATE TABLE messprogramm_mmt (
996
f77a9e85b122 Declare primary keys in tabel definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 995
diff changeset
146 id serial PRIMARY KEY,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
147 messprogramm_id integer NOT NULL REFERENCES messprogramm ON DELETE CASCADE,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
148 mmt_id character varying(2) NOT NULL REFERENCES stammdaten.mess_methode,
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
149 messgroessen integer[],
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
150 letzte_aenderung timestamp without time zone DEFAULT now()
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
151 );
926
9121d99a471e Use databse triggers for update on field 'letzteAenderung'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 914
diff changeset
152 CREATE TRIGGER letzte_aenderung_messprogramm_mmt BEFORE UPDATE ON messprogramm_mmt FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
153
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
154
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
155 --
799
2059ac26fd49 Whitespace-cleanup in schema definitions.
Tom Gottfried <tom@intevation.de>
parents: 798
diff changeset
156 -- Name: probe; Type: TABLE; Schema: land; Owner: -; Tablespace:
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
157 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
158
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
159 CREATE TABLE probe (
994
5886384dcb92 Replaced explicit sequences by serials.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 993
diff changeset
160 id serial PRIMARY KEY,
993
196800bb22b0 Replaced translation tables for probe and messung with id_alt columns.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 992
diff changeset
161 id_alt character varying(20) DEFAULT (('sss'::text || lpad(((nextval('land.probe_probe_id_seq'::regclass))::character varying)::text, 12, '0'::text)) || 'Y'::text) NOT NULL,
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
162 test boolean DEFAULT false NOT NULL,
1006
599bd9462e62 Removed duplicated netzbetreiber column. (mst_id already contains the
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1005
diff changeset
163 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
599bd9462e62 Removed duplicated netzbetreiber column. (mst_id already contains the
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1005
diff changeset
164 labor_mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle,
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
165 hauptproben_nr character varying(20),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
166 datenbasis_id smallint REFERENCES stammdaten.datenbasis,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
167 ba_id character varying(1),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
168 probenart_id smallint NOT NULL REFERENCES stammdaten.probenart,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
169 media_desk character varying(100),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
170 media character varying(100),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
171 umw_id character varying(3) REFERENCES stammdaten.umwelt,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
172 probeentnahme_beginn timestamp with time zone,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
173 probeentnahme_ende timestamp with time zone,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
174 mittelungsdauer bigint,
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
175 letzte_aenderung timestamp without time zone DEFAULT now(),
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
176 erzeuger_id integer,
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
177 probe_nehmer_id integer,
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
178 mp_kat character(1),
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
179 mpl_id character varying(3),
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
180 mpr_id integer,
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
181 solldatum_beginn timestamp without time zone,
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
182 solldatum_ende timestamp without time zone,
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
183 tree_modified timestamp without time zone DEFAULT now(),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
184 UNIQUE (mst_id, hauptproben_nr)
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
185 );
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
186 CREATE TRIGGER letzte_aenderung_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
187 CREATE TRIGGER tree_modified_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_tree_modified_probe();
899
4bbfc9cff5d7 Improve readability of DDL for probe tables.
Tom Gottfried <tom@intevation.de>
parents: 898
diff changeset
188
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
189
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
190 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
191 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
192 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
193
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
194 CREATE TABLE kommentar_p (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
195 id serial PRIMARY KEY,
1007
6a313cb77fda Renamed erzeuger to mst_id.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1006
diff changeset
196 mst_id character varying(5) NOT NULL,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
197 datum timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
198 text character varying(1024),
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
199 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
200 );
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
201
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
202
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
203 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
204 -- Name: ortszuordnung; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
205 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
206
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
207 CREATE TABLE ortszuordnung (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
208 id serial PRIMARY KEY,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
209 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
210 ort_id bigint NOT NULL REFERENCES stammdaten.ort,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
211 ortszuordnung_typ character varying(1) REFERENCES stammdaten.ortszuordnung_typ,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
212 ortszusatztext character varying(100),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
213 letzte_aenderung timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
214 tree_modified timestamp without time zone DEFAULT now()
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
215 );
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
216 CREATE TRIGGER letzte_aenderung_ortszuordnung BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
217 CREATE TRIGGER tree_modified_ortszuordnung BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_tree_modified();
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
218
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
219
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
220 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
221 -- Name: zusatz_wert; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
222 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
223
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
224 CREATE TABLE zusatz_wert (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
225 id serial PRIMARY KEY,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
226 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
227 pzs_id character varying(3) NOT NULL REFERENCES stammdaten.proben_zusatz,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
228 messwert_pzs double precision,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
229 messfehler real,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
230 letzte_aenderung timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
231 nwg_zu_messwert double precision,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
232 tree_modified timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
233 UNIQUE (probe_id, pzs_id)
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
234 );
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
235 CREATE TRIGGER letzte_aenderung_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
236 CREATE TRIGGER tree_modified_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_tree_modified();
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
237
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
238
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
239 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
240 -- Name: messung; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
241 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
242
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
243 CREATE TABLE messung (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
244 id serial PRIMARY KEY,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
245 id_alt integer DEFAULT nextval('land.messung_messung_id_alt_seq'::regclass) NOT NULL,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
246 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
247 nebenproben_nr character varying(10),
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
248 mmt_id character varying(2) NOT NULL REFERENCES stammdaten.mess_methode ON DELETE CASCADE,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
249 messdauer integer,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
250 messzeitpunkt timestamp with time zone,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
251 fertig boolean DEFAULT false NOT NULL,
1003
552215760ba8 Moved messung.status FK constraint.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1002
diff changeset
252 status integer,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
253 letzte_aenderung timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
254 geplant boolean DEFAULT false NOT NULL,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
255 tree_modified timestamp without time zone DEFAULT now()
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
256 );
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
257 CREATE TRIGGER letzte_aenderung_messung BEFORE UPDATE ON messung FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
258 CREATE TRIGGER tree_modified_messung BEFORE UPDATE ON messung FOR EACH ROW EXECUTE PROCEDURE update_tree_modified_messung();
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
259
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
260
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
261 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
262 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
263 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
264
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
265 CREATE TABLE kommentar_m (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
266 id serial PRIMARY KEY,
1007
6a313cb77fda Renamed erzeuger to mst_id.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1006
diff changeset
267 mst_id character varying(5) NOT NULL,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
268 datum timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
269 text character varying(1024),
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
270 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
271 );
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
272
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
273
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
274 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
275 -- Name: messwert; Type: TABLE; Schema: land; Owner: -; Tablespace:
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
276 --
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
277
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
278 CREATE TABLE messwert (
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
279 id serial PRIMARY KEY,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
280 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
281 messgroesse_id integer NOT NULL REFERENCES stammdaten.messgroesse,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
282 messwert_nwg character varying(1),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
283 messwert double precision NOT NULL,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
284 messfehler real,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
285 nwg_zu_messwert double precision,
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
286 meh_id smallint NOT NULL REFERENCES stammdaten.mess_einheit,
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
287 grenzwertueberschreitung boolean DEFAULT false,
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
288 letzte_aenderung timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
289 tree_modified timestamp without time zone DEFAULT now(),
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
290 UNIQUE (messungs_id, messgroesse_id)
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
291 );
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
292 CREATE TRIGGER letzte_aenderung_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
293 CREATE TRIGGER tree_modified_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_tree_modified();
999
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
294
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
295
813461e9a7be Reordered table creation to allow inline definition of FKs.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 998
diff changeset
296 --
799
2059ac26fd49 Whitespace-cleanup in schema definitions.
Tom Gottfried <tom@intevation.de>
parents: 798
diff changeset
297 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace:
751
37a8f4d157c7 Updated lada schema: Added status workflow model and cleaned up some triggers.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 741
diff changeset
298 --
37a8f4d157c7 Updated lada schema: Added status workflow model and cleaned up some triggers.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 741
diff changeset
299
37a8f4d157c7 Updated lada schema: Added status workflow model and cleaned up some triggers.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 741
diff changeset
300 CREATE TABLE status_protokoll (
996
f77a9e85b122 Declare primary keys in tabel definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 995
diff changeset
301 id serial PRIMARY KEY,
1007
6a313cb77fda Renamed erzeuger to mst_id.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1006
diff changeset
302 mst_id character varying(5) NOT NULL,
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
303 datum timestamp without time zone DEFAULT now(),
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
304 text character varying(1024),
1000
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
305 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
306 status_stufe integer NOT NULL REFERENCES stammdaten.status_stufe,
1489f0ade850 Moved FK constraints into table definition.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
307 status_wert integer NOT NULL REFERENCES stammdaten.status_wert,
992
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
308 tree_modified timestamp without time zone DEFAULT now()
9002ebe2a8af Removed schema 'bund'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 989
diff changeset
309 );
1002
8ec5ee1c2dc6 Updated trigger and functions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1001
diff changeset
310 CREATE TRIGGER tree_modified_status_protokoll BEFORE UPDATE ON status_protokoll FOR EACH ROW EXECUTE PROCEDURE update_tree_modified();
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
311
1003
552215760ba8 Moved messung.status FK constraint.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1002
diff changeset
312 ALTER TABLE ONLY messung
552215760ba8 Moved messung.status FK constraint.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1002
diff changeset
313 ADD CONSTRAINT messung_status_protokoll_id_fkey FOREIGN KEY (status) REFERENCES status_protokoll(id);
552215760ba8 Moved messung.status FK constraint.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1002
diff changeset
314
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
315
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
316 --
799
2059ac26fd49 Whitespace-cleanup in schema definitions.
Tom Gottfried <tom@intevation.de>
parents: 798
diff changeset
317 -- Name: messung_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
318 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
319
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
320 CREATE INDEX messung_probe_id_idx ON messung USING btree (probe_id);
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
321
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
322
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
323 --
1004
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
324 -- Name: ort_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
325 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
326
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
327 CREATE INDEX ort_probe_id_idx ON ortszuordnung USING btree (probe_id);
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
328
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
329
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
330 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
331 -- Name: zusatz_wert_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
332 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
333
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
334 CREATE INDEX zusatz_wert_probe_id_idx ON zusatz_wert USING btree (probe_id);
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
335
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
336
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
337 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
338 -- Name: kommentar_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
339 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
340
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
341 CREATE INDEX kommentar_probe_id_idx ON kommentar_p USING btree (probe_id);
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
342
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
343
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
344 --
799
2059ac26fd49 Whitespace-cleanup in schema definitions.
Tom Gottfried <tom@intevation.de>
parents: 798
diff changeset
345 -- Name: messwert_messungs_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
346 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
347
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
348 CREATE INDEX messwert_messungs_id_idx ON messwert USING btree (messungs_id);
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
349
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
350
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
351 --
1004
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
352 -- Name: status_messungs_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
353 --
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
354
1004
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
355 CREATE INDEX status_messungs_id_idx ON status_protokoll USING btree (messungs_id);
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
356
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
357
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
358 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
359 -- Name: kommentar_messungs_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
360 --
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
361
c0ff3965c266 Added index for "child"-tables and removed index for probe.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1003
diff changeset
362 CREATE INDEX kommentar_messungs_id_idx ON kommentar_m USING btree (messungs_id);
741
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
363
c998673c6d1e Add initial DB schema script.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
364
1005
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
365 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
366 -- Name: COLUMN ortszuordnung.ortszuordnung_typ; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
367 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
368
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
369 COMMENT ON COLUMN ortszuordnung.ortszuordnung_typ IS 'E = Entnahmeport, U = Ursprungsort, Z = Ortszusatz';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
370
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
371
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
372 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
373 -- Name: COLUMN probe.id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
374 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
375
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
376 COMMENT ON COLUMN probe.id IS 'interner Probenschlüssel';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
377
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
378
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
379 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
380 -- Name: COLUMN probe.test; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
381 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
382
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
383 COMMENT ON COLUMN probe.test IS 'Ist Testdatensatz?';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
384
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
385
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
386 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
387 -- Name: COLUMN probe.mst_id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
388 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
389
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
390 COMMENT ON COLUMN probe.mst_id IS 'ID für Messstelle';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
391
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
392
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
393 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
394 -- Name: COLUMN probe.labor_mst_id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
395 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
396
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
397 COMMENT ON COLUMN probe.labor_mst_id IS '-- ID für Messlabor';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
398
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
399
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
400 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
401 -- Name: COLUMN probe.hauptproben_nr; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
402 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
403
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
404 COMMENT ON COLUMN probe.hauptproben_nr IS 'externer Probensclüssel';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
405
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
406
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
407 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
408 -- Name: COLUMN probe.ba_id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
409 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
410
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
411 COMMENT ON COLUMN probe.ba_id IS 'ID der Betriebsart (normal/Routine oder Störfall/intensiv)';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
412
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
413
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
414 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
415 -- Name: COLUMN probe.probenart_id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
416 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
417
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
418 COMMENT ON COLUMN probe.probenart_id IS 'ID der Probenart(Einzel-, Sammel-, Misch- ...Probe)';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
419
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
420
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
421 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
422 -- Name: COLUMN probe.media_desk; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
423 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
424
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
425 COMMENT ON COLUMN probe.media_desk IS 'Mediencodierung (Deskriptoren oder ADV-Codierung)';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
426
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
427
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
428 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
429 -- Name: COLUMN probe.media; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
430 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
431
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
432 COMMENT ON COLUMN probe.media IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
433
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
434
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
435 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
436 -- Name: COLUMN probe.umw_id; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
437 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
438
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
439 COMMENT ON COLUMN probe.umw_id IS 'ID für Umweltbereich';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
440
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
441
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
442 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
443 -- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: -
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
444 --
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
445
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
446 COMMENT ON COLUMN messprogramm.media_desk IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)';
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
447
e9116ec4eb40 Moved comments to the end of the file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1004
diff changeset
448
797
e15c981fe310 Do not create database objects in case of erroneous definitions.
Tom Gottfried <tom@intevation.de>
parents: 792
diff changeset
449 COMMIT;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)