comparison db_schema/stammdaten_schema.sql @ 1030:330dec7ee0bb schema-update

merged.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 08 Jul 2016 15:35:24 +0200
parents b29098d201c2 3779455b621c
children 1c6c83037b8c
comparison
equal deleted inserted replaced
1029:b29098d201c2 1030:330dec7ee0bb
401 CREATE TABLE ort_typ ( 401 CREATE TABLE ort_typ (
402 id smallint PRIMARY KEY, 402 id smallint PRIMARY KEY,
403 ort_typ character varying(60) 403 ort_typ character varying(60)
404 ); 404 );
405 405
406 CREATE TABLE kta (
407 id serial NOT NULL,
408 code character varying(7),
409 bezeichnung character varying(80),
410 CONSTRAINT kta_pkey PRIMARY KEY (id)
411 );
412 COMMENT ON TABLE kta
413 IS 'kernteschnische Anlagen';
414
415 CREATE TABLE ortszusatz (
416 id serial NOT NULL,
417 code character varying(7),
418 bezeichnung character varying(80),
419 CONSTRAINT ortszusatz_pkey PRIMARY KEY (id)
420 );
406 421
407 CREATE TABLE ort ( 422 CREATE TABLE ort (
408 id serial PRIMARY KEY, 423 id serial PRIMARY KEY,
409 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, 424 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber,
410 ort_id character varying(10) NOT NULL, 425 ort_id character varying(10) NOT NULL,
430 zustaendigkeit character varying(10), 445 zustaendigkeit character varying(10),
431 mp_art character varying(10), 446 mp_art character varying(10),
432 aktiv character(1), 447 aktiv character(1),
433 anlage_id integer, 448 anlage_id integer,
434 oz_id integer, 449 oz_id integer,
450 hoehe_ueber_nn real,
435 UNIQUE(ort_id, netzbetreiber_id) 451 UNIQUE(ort_id, netzbetreiber_id)
436 ); 452 );
453
437 CREATE TRIGGER letzte_aenderung_ort BEFORE UPDATE ON ort FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 454 CREATE TRIGGER letzte_aenderung_ort BEFORE UPDATE ON ort FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
438 455
439 ALTER TABLE ONLY ort 456 ALTER TABLE ONLY ort
440 ADD CONSTRAINT ort_anlage_fkey FOREIGN KEY (anlage_id) REFERENCES ort(id); 457 ADD CONSTRAINT ort_kta_fkey FOREIGN KEY (anlage_id) REFERENCES kta(id);
441 458
442 ALTER TABLE ONLY ort 459 ALTER TABLE ONLY ort
443 ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id); 460 ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id);
444 461
445 462
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)