Mercurial > lada > lada-server
comparison 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 |
comparison
equal
deleted
inserted
replaced
1008:17e9d1b2d471 | 1009:f0ac901a4387 |
---|---|
118 test boolean DEFAULT false NOT NULL, | 118 test boolean DEFAULT false NOT NULL, |
119 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, | 119 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
120 labor_mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, | 120 labor_mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
121 datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis, | 121 datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis, |
122 ba_id character varying(1), | 122 ba_id character varying(1), |
123 gem_id character varying(8), | 123 gem_id character varying(8) REFERENCES stammdaten.verwaltungseinheit, |
124 ort_id integer NOT NULL REFERENCES stammdaten.ort, | 124 ort_id integer NOT NULL REFERENCES stammdaten.ort, |
125 media_desk character varying(100), | 125 media_desk character varying(100), |
126 umw_id character varying(3) REFERENCES stammdaten.umwelt, | 126 umw_id character varying(3) REFERENCES stammdaten.umwelt, |
127 probenart_id integer NOT NULL REFERENCES stammdaten.probenart, | 127 probenart_id integer NOT NULL REFERENCES stammdaten.probenart, |
128 probenintervall character varying(2) NOT NULL, | 128 probenintervall character varying(2) NOT NULL, |
129 teilintervall_von integer NOT NULL, | 129 teilintervall_von integer NOT NULL, |
130 teilintervall_bis integer NOT NULL, | 130 teilintervall_bis integer NOT NULL, |
131 intervall_offset integer, | 131 intervall_offset integer, |
132 gueltig_von integer NOT NULL, | 132 gueltig_von integer NOT NULL, |
133 gueltig_bis integer NOT NULL, | 133 gueltig_bis integer NOT NULL, |
134 probe_nehmer_id integer, | 134 probe_nehmer_id integer REFERENCES stammdaten.probenehmer, |
135 probe_kommentar character varying(80), | 135 probe_kommentar character varying(80), |
136 letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL | 136 letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL |
137 ); | 137 ); |
138 CREATE TRIGGER letzte_aenderung_messprogramm BEFORE UPDATE ON messprogramm FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); | 138 CREATE TRIGGER letzte_aenderung_messprogramm BEFORE UPDATE ON messprogramm FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); |
139 | 139 |
171 umw_id character varying(3) REFERENCES stammdaten.umwelt, | 171 umw_id character varying(3) REFERENCES stammdaten.umwelt, |
172 probeentnahme_beginn timestamp with time zone, | 172 probeentnahme_beginn timestamp with time zone, |
173 probeentnahme_ende timestamp with time zone, | 173 probeentnahme_ende timestamp with time zone, |
174 mittelungsdauer bigint, | 174 mittelungsdauer bigint, |
175 letzte_aenderung timestamp without time zone DEFAULT now(), | 175 letzte_aenderung timestamp without time zone DEFAULT now(), |
176 erzeuger_id integer, | 176 erzeuger_id integer REFERENCES stammdaten.datensatz_erzeuger, |
177 probe_nehmer_id integer, | 177 probe_nehmer_id integer REFERENCES stammdaten.probenehmer, |
178 mp_kat character(1), | 178 mpl_id integer REFERENCES stammdaten.messprogramm_kategorie, |
179 mpl_id character varying(3), | 179 mpr_id integer REFERENCES messprogramm, |
180 mpr_id integer, | |
181 solldatum_beginn timestamp without time zone, | 180 solldatum_beginn timestamp without time zone, |
182 solldatum_ende timestamp without time zone, | 181 solldatum_ende timestamp without time zone, |
183 tree_modified timestamp without time zone DEFAULT now(), | 182 tree_modified timestamp without time zone DEFAULT now(), |
184 UNIQUE (mst_id, hauptproben_nr) | 183 UNIQUE (mst_id, hauptproben_nr) |
185 ); | 184 ); |
191 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace: | 190 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace: |
192 -- | 191 -- |
193 | 192 |
194 CREATE TABLE kommentar_p ( | 193 CREATE TABLE kommentar_p ( |
195 id serial PRIMARY KEY, | 194 id serial PRIMARY KEY, |
196 mst_id character varying(5) NOT NULL, | 195 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
197 datum timestamp without time zone DEFAULT now(), | 196 datum timestamp without time zone DEFAULT now(), |
198 text character varying(1024), | 197 text character varying(1024), |
199 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE | 198 probe_id integer NOT NULL REFERENCES probe ON DELETE CASCADE |
200 ); | 199 ); |
201 | 200 |
262 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace: | 261 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace: |
263 -- | 262 -- |
264 | 263 |
265 CREATE TABLE kommentar_m ( | 264 CREATE TABLE kommentar_m ( |
266 id serial PRIMARY KEY, | 265 id serial PRIMARY KEY, |
267 mst_id character varying(5) NOT NULL, | 266 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
268 datum timestamp without time zone DEFAULT now(), | 267 datum timestamp without time zone DEFAULT now(), |
269 text character varying(1024), | 268 text character varying(1024), |
270 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE | 269 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE |
271 ); | 270 ); |
272 | 271 |
297 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace: | 296 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace: |
298 -- | 297 -- |
299 | 298 |
300 CREATE TABLE status_protokoll ( | 299 CREATE TABLE status_protokoll ( |
301 id serial PRIMARY KEY, | 300 id serial PRIMARY KEY, |
302 mst_id character varying(5) NOT NULL, | 301 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
303 datum timestamp without time zone DEFAULT now(), | 302 datum timestamp without time zone DEFAULT now(), |
304 text character varying(1024), | 303 text character varying(1024), |
305 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE, | 304 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE, |
306 status_stufe integer NOT NULL REFERENCES stammdaten.status_stufe, | 305 status_stufe integer NOT NULL REFERENCES stammdaten.status_stufe, |
307 status_wert integer NOT NULL REFERENCES stammdaten.status_wert, | 306 status_wert integer NOT NULL REFERENCES stammdaten.status_wert, |