comparison db_schema/lada_schema.sql @ 1001:1c4aa7ea63aa schema-update

Moved trigger creation to table definition.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 01 Jul 2016 19:04:49 +0200
parents 1489f0ade850
children 8ec5ee1c2dc6
comparison
equal deleted inserted replaced
1000:1489f0ade850 1001:1c4aa7ea63aa
250 solldatum_ende timestamp without time zone, 250 solldatum_ende timestamp without time zone,
251 tree_modified timestamp without time zone DEFAULT now(), 251 tree_modified timestamp without time zone DEFAULT now(),
252 UNIQUE (mst_id, hauptproben_nr) 252 UNIQUE (mst_id, hauptproben_nr)
253 ); 253 );
254 CREATE TRIGGER letzte_aenderung_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 254 CREATE TRIGGER letzte_aenderung_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
255 CREATE TRIGGER tree_timestamp_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_time_probe();
255 256
256 257
257 -- 258 --
258 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace: 259 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace:
259 -- 260 --
279 ortszusatztext character varying(100), 280 ortszusatztext character varying(100),
280 letzte_aenderung timestamp without time zone DEFAULT now(), 281 letzte_aenderung timestamp without time zone DEFAULT now(),
281 tree_modified timestamp without time zone DEFAULT now() 282 tree_modified timestamp without time zone DEFAULT now()
282 ); 283 );
283 CREATE TRIGGER letzte_aenderung_ortszuordnung BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 284 CREATE TRIGGER letzte_aenderung_ortszuordnung BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
285 CREATE TRIGGER tree_timestamp_ort BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_time_ort();
284 286
285 287
286 -- 288 --
287 -- Name: zusatz_wert; Type: TABLE; Schema: land; Owner: -; Tablespace: 289 -- Name: zusatz_wert; Type: TABLE; Schema: land; Owner: -; Tablespace:
288 -- 290 --
297 nwg_zu_messwert double precision, 299 nwg_zu_messwert double precision,
298 tree_modified timestamp without time zone DEFAULT now(), 300 tree_modified timestamp without time zone DEFAULT now(),
299 UNIQUE (probe_id, pzs_id) 301 UNIQUE (probe_id, pzs_id)
300 ); 302 );
301 CREATE TRIGGER letzte_aenderung_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 303 CREATE TRIGGER letzte_aenderung_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
304 CREATE TRIGGER tree_timestamp_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_time_zusatzwert();
302 305
303 306
304 -- 307 --
305 -- Name: COLUMN ortszuordnung.ortszuordnung_typ; Type: COMMENT; Schema: land; Owner: - 308 -- Name: COLUMN ortszuordnung.ortszuordnung_typ; Type: COMMENT; Schema: land; Owner: -
306 -- 309 --
394 status integer REFERENCES status_protokoll, 397 status integer REFERENCES status_protokoll,
395 letzte_aenderung timestamp without time zone DEFAULT now(), 398 letzte_aenderung timestamp without time zone DEFAULT now(),
396 geplant boolean DEFAULT false NOT NULL, 399 geplant boolean DEFAULT false NOT NULL,
397 tree_modified timestamp without time zone DEFAULT now() 400 tree_modified timestamp without time zone DEFAULT now()
398 ); 401 );
402 CREATE TRIGGER tree_timestamp_messung BEFORE UPDATE ON messung FOR EACH ROW EXECUTE PROCEDURE update_time_messung();
399 403
400 404
401 -- 405 --
402 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace: 406 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace:
403 -- 407 --
428 letzte_aenderung timestamp without time zone DEFAULT now(), 432 letzte_aenderung timestamp without time zone DEFAULT now(),
429 tree_modified timestamp without time zone DEFAULT now(), 433 tree_modified timestamp without time zone DEFAULT now(),
430 UNIQUE (messungs_id, messgroesse_id) 434 UNIQUE (messungs_id, messgroesse_id)
431 ); 435 );
432 CREATE TRIGGER letzte_aenderung_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 436 CREATE TRIGGER letzte_aenderung_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
437 CREATE TRIGGER tree_timestamp_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_time_messwert();
433 438
434 439
435 -- 440 --
436 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace: 441 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace:
437 -- 442 --
444 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE, 449 messungs_id integer NOT NULL REFERENCES messung ON DELETE CASCADE,
445 status_stufe integer NOT NULL REFERENCES stammdaten.status_stufe, 450 status_stufe integer NOT NULL REFERENCES stammdaten.status_stufe,
446 status_wert integer NOT NULL REFERENCES stammdaten.status_wert, 451 status_wert integer NOT NULL REFERENCES stammdaten.status_wert,
447 tree_modified timestamp without time zone DEFAULT now() 452 tree_modified timestamp without time zone DEFAULT now()
448 ); 453 );
454 CREATE TRIGGER tree_timestamp_status BEFORE UPDATE ON status_protokoll FOR EACH ROW EXECUTE PROCEDURE update_time_status();
449 455
450 456
451 -- 457 --
452 -- Name: messung_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace: 458 -- Name: messung_probe_id_idx; Type: INDEX; Schema: land; Owner: -; Tablespace:
453 -- 459 --
467 -- 473 --
468 474
469 CREATE INDEX probe_id_idx ON probe USING btree (id); 475 CREATE INDEX probe_id_idx ON probe USING btree (id);
470 476
471 477
472 --
473 -- Name: tree_timestamp_status; Type: TRIGGER; Schema: land; Owner: -
474 --
475
476 CREATE TRIGGER tree_timestamp_status BEFORE UPDATE ON status_protokoll FOR EACH ROW EXECUTE PROCEDURE update_time_status();
477
478
479 --
480 -- Name: tree_timestamp_messung; Type: TRIGGER; Schema: land; Owner: -
481 --
482
483 CREATE TRIGGER tree_timestamp_messung BEFORE UPDATE ON messung FOR EACH ROW EXECUTE PROCEDURE update_time_messung();
484
485
486 --
487 -- Name: tree_timestamp_messwert; Type: TRIGGER; Schema: land; Owner: -
488 --
489
490 CREATE TRIGGER tree_timestamp_messwert BEFORE UPDATE ON messwert FOR EACH ROW EXECUTE PROCEDURE update_time_messwert();
491
492
493 --
494 -- Name: tree_timestamp_ort; Type: TRIGGER; Schema: land; Owner: -
495 --
496
497 CREATE TRIGGER tree_timestamp_ort BEFORE UPDATE ON ortszuordnung FOR EACH ROW EXECUTE PROCEDURE update_time_ort();
498
499
500 --
501 -- Name: tree_timestamp_probe; Type: TRIGGER; Schema: land; Owner: -
502 --
503
504 CREATE TRIGGER tree_timestamp_probe BEFORE UPDATE ON probe FOR EACH ROW EXECUTE PROCEDURE update_time_probe();
505
506
507 --
508 -- Name: tree_timestamp_zusatzwert; Type: TRIGGER; Schema: land; Owner: -
509 --
510
511 CREATE TRIGGER tree_timestamp_zusatzwert BEFORE UPDATE ON zusatz_wert FOR EACH ROW EXECUTE PROCEDURE update_time_zusatzwert();
512
513
514 COMMIT; 478 COMMIT;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)