Mercurial > lada > lada-server
comparison db_schema/stammdaten_schema.sql @ 1143:b49c1fb84040
Updated stammdaten schema.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 07 Nov 2016 10:04:57 +0100 |
parents | d1d7d684800c |
children | 60b91dbb98cc |
comparison
equal
deleted
inserted
replaced
1142:7730d9cfc22e | 1143:b49c1fb84040 |
---|---|
411 ); | 411 ); |
412 COMMENT ON TABLE kta | 412 COMMENT ON TABLE kta |
413 IS 'kernteschnische Anlagen'; | 413 IS 'kernteschnische Anlagen'; |
414 | 414 |
415 CREATE TABLE ortszusatz ( | 415 CREATE TABLE ortszusatz ( |
416 id serial NOT NULL, | 416 ozs_id character varying(7) PRIMARY KEY, |
417 code character varying(7), | 417 ortszusatz character varying(80) NOT NULL |
418 bezeichnung character varying(80), | |
419 CONSTRAINT ortszusatz_pkey PRIMARY KEY (id) | |
420 ); | 418 ); |
421 | 419 |
422 CREATE TABLE ort ( | 420 CREATE TABLE ort ( |
423 id serial PRIMARY KEY, | 421 id serial PRIMARY KEY, |
424 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, | 422 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, |
444 sektor character varying(2), | 442 sektor character varying(2), |
445 zustaendigkeit character varying(10), | 443 zustaendigkeit character varying(10), |
446 mp_art character varying(10), | 444 mp_art character varying(10), |
447 aktiv character(1), | 445 aktiv character(1), |
448 anlage_id integer, | 446 anlage_id integer, |
449 oz_id integer, | 447 oz_id character varying(7) REFERENCES ortszusatz(ozs_id), |
450 hoehe_ueber_nn real, | 448 hoehe_ueber_nn real, |
451 UNIQUE(ort_id, netzbetreiber_id) | 449 UNIQUE(ort_id, netzbetreiber_id) |
452 ); | 450 ); |
453 | 451 |
454 CREATE TRIGGER letzte_aenderung_ort BEFORE UPDATE ON ort FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); | 452 CREATE TRIGGER letzte_aenderung_ort BEFORE UPDATE ON ort FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); |
455 | 453 |
456 ALTER TABLE ONLY ort | 454 ALTER TABLE ONLY ort |
457 ADD CONSTRAINT ort_kta_fkey FOREIGN KEY (anlage_id) REFERENCES kta(id); | 455 ADD CONSTRAINT ort_kta_fkey FOREIGN KEY (anlage_id) REFERENCES kta(id); |
458 | |
459 ALTER TABLE ONLY ort | |
460 ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id); | |
461 | 456 |
462 | 457 |
463 CREATE TABLE ortszuordnung_typ ( | 458 CREATE TABLE ortszuordnung_typ ( |
464 id character(1) PRIMARY KEY, | 459 id character(1) PRIMARY KEY, |
465 ortstyp character varying(60) | 460 ortstyp character varying(60) |