Mercurial > lada > lada-server
comparison db_schema/lada_schema.sql @ 900:26d57ae6dd2f
Improve readability of DDL for messprogramm table.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 23 Mar 2016 13:07:11 +0100 |
parents | 4bbfc9cff5d7 |
children | 56c9fb1d37c8 |
comparison
equal
deleted
inserted
replaced
899:4bbfc9cff5d7 | 900:26d57ae6dd2f |
---|---|
519 ) | 519 ) |
520 INHERITS (bund.kommentar_p); | 520 INHERITS (bund.kommentar_p); |
521 | 521 |
522 | 522 |
523 -- | 523 -- |
524 -- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: - | |
525 -- | |
526 | |
527 CREATE SEQUENCE messprogramm_id_seq | |
528 START WITH 1 | |
529 INCREMENT BY 1 | |
530 NO MINVALUE | |
531 NO MAXVALUE | |
532 CACHE 1; | |
533 | |
534 | |
535 -- | |
524 -- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace: | 536 -- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace: |
525 -- | 537 -- |
526 | 538 |
527 CREATE TABLE messprogramm ( | 539 CREATE TABLE messprogramm ( |
528 id integer NOT NULL, | 540 id integer PRIMARY KEY DEFAULT nextval('messprogramm_id_seq'::regclass), |
529 name character varying(256), | 541 name character varying(256), |
530 test boolean DEFAULT false NOT NULL, | 542 test boolean DEFAULT false NOT NULL, |
531 netzbetreiber_id character varying(2) NOT NULL, | 543 netzbetreiber_id character varying(2) NOT NULL |
532 mst_id character varying(5) NOT NULL, | 544 REFERENCES stammdaten.netz_betreiber, |
533 labor_mst_id character varying(5), | 545 mst_id character varying(5) NOT NULL REFERENCES stammdaten.mess_stelle, |
534 datenbasis_id integer NOT NULL, | 546 labor_mst_id character varying(5) REFERENCES stammdaten.mess_stelle, |
547 datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis, | |
535 ba_id character varying(1), | 548 ba_id character varying(1), |
536 gem_id character varying(8), | 549 gem_id character varying(8), |
537 ort_id integer, | 550 ort_id integer REFERENCES stammdaten.ort, |
538 media_desk character varying(100), | 551 media_desk character varying(100), |
539 umw_id character varying(3), | 552 umw_id character varying(3) REFERENCES stammdaten.umwelt, |
540 probenart_id integer NOT NULL, | 553 probenart_id integer NOT NULL REFERENCES stammdaten.probenart, |
541 probenintervall character varying(2), | 554 probenintervall character varying(2), |
542 teilintervall_von integer, | 555 teilintervall_von integer, |
543 teilintervall_bis integer, | 556 teilintervall_bis integer, |
544 intervall_offset integer, | 557 intervall_offset integer, |
545 gueltig_von integer, | 558 gueltig_von integer, |
547 probe_nehmer_id integer, | 560 probe_nehmer_id integer, |
548 probe_kommentar character varying(80), | 561 probe_kommentar character varying(80), |
549 letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL | 562 letzte_aenderung timestamp without time zone DEFAULT now() NOT NULL |
550 ); | 563 ); |
551 | 564 |
565 -- | |
566 -- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: - | |
567 -- | |
568 | |
569 ALTER SEQUENCE messprogramm_id_seq OWNED BY messprogramm.id; | |
570 | |
552 | 571 |
553 -- | 572 -- |
554 -- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: - | 573 -- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: - |
555 -- | 574 -- |
556 | 575 |
557 COMMENT ON COLUMN messprogramm.media_desk IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)'; | 576 COMMENT ON COLUMN messprogramm.media_desk IS 'dekodierte Medienbezeichnung (aus media_desk abgeleitet)'; |
558 | |
559 | |
560 -- | |
561 -- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: - | |
562 -- | |
563 | |
564 CREATE SEQUENCE messprogramm_id_seq | |
565 START WITH 1 | |
566 INCREMENT BY 1 | |
567 NO MINVALUE | |
568 NO MAXVALUE | |
569 CACHE 1; | |
570 | |
571 | |
572 -- | |
573 -- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: - | |
574 -- | |
575 | |
576 ALTER SEQUENCE messprogramm_id_seq OWNED BY messprogramm.id; | |
577 | 577 |
578 | 578 |
579 -- | 579 -- |
580 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace: | 580 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace: |
581 -- | 581 -- |
845 | 845 |
846 -- | 846 -- |
847 -- Name: id; Type: DEFAULT; Schema: land; Owner: - | 847 -- Name: id; Type: DEFAULT; Schema: land; Owner: - |
848 -- | 848 -- |
849 | 849 |
850 ALTER TABLE ONLY messprogramm ALTER COLUMN id SET DEFAULT nextval('messprogramm_id_seq'::regclass); | |
851 | |
852 | |
853 -- | |
854 -- Name: id; Type: DEFAULT; Schema: land; Owner: - | |
855 -- | |
856 | |
857 ALTER TABLE ONLY messprogramm_mmt ALTER COLUMN id SET DEFAULT nextval('messprogramm_mmt_id_seq'::regclass); | 850 ALTER TABLE ONLY messprogramm_mmt ALTER COLUMN id SET DEFAULT nextval('messprogramm_mmt_id_seq'::regclass); |
858 | 851 |
859 | 852 |
860 -- | 853 -- |
861 -- Name: id; Type: DEFAULT; Schema: land; Owner: - | 854 -- Name: id; Type: DEFAULT; Schema: land; Owner: - |
1061 ALTER TABLE ONLY messprogramm_mmt | 1054 ALTER TABLE ONLY messprogramm_mmt |
1062 ADD CONSTRAINT messprogramm_mmt_pkey PRIMARY KEY (id); | 1055 ADD CONSTRAINT messprogramm_mmt_pkey PRIMARY KEY (id); |
1063 | 1056 |
1064 | 1057 |
1065 -- | 1058 -- |
1066 -- Name: messprogramm_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace: | |
1067 -- | |
1068 | |
1069 ALTER TABLE ONLY messprogramm | |
1070 ADD CONSTRAINT messprogramm_pkey PRIMARY KEY (id); | |
1071 | |
1072 | |
1073 -- | |
1074 -- Name: messung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace: | 1059 -- Name: messung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace: |
1075 -- | 1060 -- |
1076 | 1061 |
1077 ALTER TABLE ONLY messung | 1062 ALTER TABLE ONLY messung |
1078 ADD CONSTRAINT messung_pkey PRIMARY KEY (id); | 1063 ADD CONSTRAINT messung_pkey PRIMARY KEY (id); |
1396 ALTER TABLE ONLY kommentar_p | 1381 ALTER TABLE ONLY kommentar_p |
1397 ADD CONSTRAINT kommentar_p_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id) ON DELETE CASCADE; | 1382 ADD CONSTRAINT kommentar_p_probe_id_fkey FOREIGN KEY (probe_id) REFERENCES probe(id) ON DELETE CASCADE; |
1398 | 1383 |
1399 | 1384 |
1400 -- | 1385 -- |
1401 -- Name: messprogramm_datenbasis_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1402 -- | |
1403 | |
1404 ALTER TABLE ONLY messprogramm | |
1405 ADD CONSTRAINT messprogramm_datenbasis_id_fkey FOREIGN KEY (datenbasis_id) REFERENCES stammdaten.datenbasis(id); | |
1406 | |
1407 | |
1408 -- | |
1409 -- Name: messprogramm_mmt_messprogramm_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | 1386 -- Name: messprogramm_mmt_messprogramm_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - |
1410 -- | 1387 -- |
1411 | 1388 |
1412 ALTER TABLE ONLY messprogramm_mmt | 1389 ALTER TABLE ONLY messprogramm_mmt |
1413 ADD CONSTRAINT messprogramm_mmt_messprogramm_id_fkey FOREIGN KEY (messprogramm_id) REFERENCES messprogramm(id) ON DELETE CASCADE; | 1390 ADD CONSTRAINT messprogramm_mmt_messprogramm_id_fkey FOREIGN KEY (messprogramm_id) REFERENCES messprogramm(id) ON DELETE CASCADE; |
1420 ALTER TABLE ONLY messprogramm_mmt | 1397 ALTER TABLE ONLY messprogramm_mmt |
1421 ADD CONSTRAINT messprogramm_mmt_mmt_id_fkey FOREIGN KEY (mmt_id) REFERENCES stammdaten.mess_methode(id); | 1398 ADD CONSTRAINT messprogramm_mmt_mmt_id_fkey FOREIGN KEY (mmt_id) REFERENCES stammdaten.mess_methode(id); |
1422 | 1399 |
1423 | 1400 |
1424 -- | 1401 -- |
1425 -- Name: messprogramm_mst_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1426 -- | |
1427 | |
1428 ALTER TABLE ONLY messprogramm | |
1429 ADD CONSTRAINT messprogramm_mst_id_fkey FOREIGN KEY (mst_id) REFERENCES stammdaten.mess_stelle(id); | |
1430 | |
1431 | |
1432 -- | |
1433 -- Name: messprogramm_netzbetreiber_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1434 -- | |
1435 | |
1436 ALTER TABLE ONLY messprogramm | |
1437 ADD CONSTRAINT messprogramm_netzbetreiber_id_fkey FOREIGN KEY (netzbetreiber_id) REFERENCES stammdaten.netz_betreiber(id); | |
1438 | |
1439 | |
1440 -- | |
1441 -- Name: messprogramm_ort_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1442 -- | |
1443 | |
1444 ALTER TABLE ONLY messprogramm | |
1445 ADD CONSTRAINT messprogramm_ort_id_fkey FOREIGN KEY (ort_id) REFERENCES stammdaten.ort(id); | |
1446 | |
1447 | |
1448 -- | |
1449 -- Name: messprogramm_probenart_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1450 -- | |
1451 | |
1452 ALTER TABLE ONLY messprogramm | |
1453 ADD CONSTRAINT messprogramm_probenart_id_fkey FOREIGN KEY (probenart_id) REFERENCES stammdaten.probenart(id); | |
1454 | |
1455 | |
1456 -- | |
1457 -- Name: messprogramm_umw_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | |
1458 -- | |
1459 | |
1460 ALTER TABLE ONLY messprogramm | |
1461 ADD CONSTRAINT messprogramm_umw_id_fkey FOREIGN KEY (umw_id) REFERENCES stammdaten.umwelt(id); | |
1462 | |
1463 | |
1464 -- | |
1465 -- Name: messung_mmt_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - | 1402 -- Name: messung_mmt_id_fkey; Type: FK CONSTRAINT; Schema: land; Owner: - |
1466 -- | 1403 -- |
1467 | 1404 |
1468 ALTER TABLE ONLY messung | 1405 ALTER TABLE ONLY messung |
1469 ADD CONSTRAINT messung_mmt_id_fkey FOREIGN KEY (mmt_id) REFERENCES stammdaten.mess_methode(id) ON DELETE CASCADE; | 1406 ADD CONSTRAINT messung_mmt_id_fkey FOREIGN KEY (mmt_id) REFERENCES stammdaten.mess_methode(id) ON DELETE CASCADE; |