comparison db_schema/lada_schema.sql @ 996:f77a9e85b122 schema-update

Declare primary keys in tabel definition.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 01 Jul 2016 18:04:21 +0200
parents c21d2e3c988a
children 1f23867d69e9
comparison
equal deleted inserted replaced
995:c21d2e3c988a 996:f77a9e85b122
166 -- 166 --
167 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace: 167 -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace:
168 -- 168 --
169 169
170 CREATE TABLE kommentar_m ( 170 CREATE TABLE kommentar_m (
171 id serial NOT NULL, 171 id serial PRIMARY KEY,
172 erzeuger character varying(5) NOT NULL, 172 erzeuger character varying(5) NOT NULL,
173 datum timestamp without time zone DEFAULT now(), 173 datum timestamp without time zone DEFAULT now(),
174 text character varying(1024), 174 text character varying(1024),
175 messungs_id integer NOT NULL 175 messungs_id integer NOT NULL
176 ); 176 );
179 -- 179 --
180 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace: 180 -- Name: kommentar_p; Type: TABLE; Schema: land; Owner: -; Tablespace:
181 -- 181 --
182 182
183 CREATE TABLE kommentar_p ( 183 CREATE TABLE kommentar_p (
184 id serial NOT NULL, 184 id serial PRIMARY KEY,
185 erzeuger character varying(5) NOT NULL, 185 erzeuger character varying(5) NOT NULL,
186 datum timestamp without time zone DEFAULT now(), 186 datum timestamp without time zone DEFAULT now(),
187 text character varying(1024), 187 text character varying(1024),
188 probe_id integer NOT NULL 188 probe_id integer NOT NULL
189 ); 189 );
232 -- 232 --
233 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace: 233 -- Name: messprogramm_mmt; Type: TABLE; Schema: land; Owner: -; Tablespace:
234 -- 234 --
235 235
236 CREATE TABLE messprogramm_mmt ( 236 CREATE TABLE messprogramm_mmt (
237 id serial NOT NULL, 237 id serial PRIMARY KEY,
238 messprogramm_id integer NOT NULL, 238 messprogramm_id integer NOT NULL,
239 mmt_id character varying(2) NOT NULL, 239 mmt_id character varying(2) NOT NULL,
240 messgroessen integer[], 240 messgroessen integer[],
241 letzte_aenderung timestamp without time zone DEFAULT now() 241 letzte_aenderung timestamp without time zone DEFAULT now()
242 ); 242 );
246 -- 246 --
247 -- Name: messung; Type: TABLE; Schema: land; Owner: -; Tablespace: 247 -- Name: messung; Type: TABLE; Schema: land; Owner: -; Tablespace:
248 -- 248 --
249 249
250 CREATE TABLE messung ( 250 CREATE TABLE messung (
251 id serial NOT NULL, 251 id serial PRIMARY KEY,
252 id_alt integer DEFAULT nextval('land.messung_messung_id_alt_seq'::regclass) NOT NULL, 252 id_alt integer DEFAULT nextval('land.messung_messung_id_alt_seq'::regclass) NOT NULL,
253 probe_id integer NOT NULL, 253 probe_id integer NOT NULL,
254 nebenproben_nr character varying(10), 254 nebenproben_nr character varying(10),
255 mmt_id character varying(2) NOT NULL, 255 mmt_id character varying(2) NOT NULL,
256 messdauer integer, 256 messdauer integer,
266 -- 266 --
267 -- Name: messwert; Type: TABLE; Schema: land; Owner: -; Tablespace: 267 -- Name: messwert; Type: TABLE; Schema: land; Owner: -; Tablespace:
268 -- 268 --
269 269
270 CREATE TABLE messwert ( 270 CREATE TABLE messwert (
271 id serial NOT NULL, 271 id serial PRIMARY KEY,
272 messungs_id integer NOT NULL, 272 messungs_id integer NOT NULL,
273 messgroesse_id integer NOT NULL, 273 messgroesse_id integer NOT NULL,
274 messwert_nwg character varying(1), 274 messwert_nwg character varying(1),
275 messwert double precision NOT NULL, 275 messwert double precision NOT NULL,
276 messfehler real, 276 messfehler real,
286 -- 286 --
287 -- Name: ortszuordnung; Type: TABLE; Schema: land; Owner: -; Tablespace: 287 -- Name: ortszuordnung; Type: TABLE; Schema: land; Owner: -; Tablespace:
288 -- 288 --
289 289
290 CREATE TABLE ortszuordnung ( 290 CREATE TABLE ortszuordnung (
291 id serial NOT NULL, 291 id serial PRIMARY KEY,
292 probe_id integer NOT NULL, 292 probe_id integer NOT NULL,
293 ort_id bigint NOT NULL, 293 ort_id bigint NOT NULL,
294 ortszuordnung_typ character varying(1), 294 ortszuordnung_typ character varying(1),
295 ortszusatztext character varying(100), 295 ortszusatztext character varying(100),
296 letzte_aenderung timestamp without time zone DEFAULT now(), 296 letzte_aenderung timestamp without time zone DEFAULT now(),
414 -- 414 --
415 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace: 415 -- Name: status_protokoll; Type: TABLE; Schema: land; Owner: -; Tablespace:
416 -- 416 --
417 417
418 CREATE TABLE status_protokoll ( 418 CREATE TABLE status_protokoll (
419 id serial NOT NULL, 419 id serial PRIMARY KEY,
420 erzeuger character varying(5) NOT NULL, 420 erzeuger character varying(5) NOT NULL,
421 datum timestamp without time zone DEFAULT now(), 421 datum timestamp without time zone DEFAULT now(),
422 text character varying(1024), 422 text character varying(1024),
423 messungs_id integer NOT NULL, 423 messungs_id integer NOT NULL,
424 status_stufe integer NOT NULL, 424 status_stufe integer NOT NULL,
430 -- 430 --
431 -- Name: zusatz_wert; Type: TABLE; Schema: land; Owner: -; Tablespace: 431 -- Name: zusatz_wert; Type: TABLE; Schema: land; Owner: -; Tablespace:
432 -- 432 --
433 433
434 CREATE TABLE zusatz_wert ( 434 CREATE TABLE zusatz_wert (
435 id serial NOT NULL, 435 id serial PRIMARY KEY,
436 probe_id integer NOT NULL, 436 probe_id integer NOT NULL,
437 pzs_id character varying(3) NOT NULL, 437 pzs_id character varying(3) NOT NULL,
438 messwert_pzs double precision, 438 messwert_pzs double precision,
439 messfehler real, 439 messfehler real,
440 letzte_aenderung timestamp without time zone DEFAULT now(), 440 letzte_aenderung timestamp without time zone DEFAULT now(),
520 520
521 ALTER TABLE ONLY zusatz_wert ALTER COLUMN letzte_aenderung SET DEFAULT now(); 521 ALTER TABLE ONLY zusatz_wert ALTER COLUMN letzte_aenderung SET DEFAULT now();
522 522
523 523
524 -- 524 --
525 -- Name: kommentar_m_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
526 --
527
528 ALTER TABLE ONLY kommentar_m
529 ADD CONSTRAINT kommentar_m_pkey PRIMARY KEY (id);
530
531
532 --
533 -- Name: kommentar_p_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
534 --
535
536 ALTER TABLE ONLY kommentar_p
537 ADD CONSTRAINT kommentar_p_pkey PRIMARY KEY (id);
538
539
540 --
541 -- Name: messprogramm_mmt_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
542 --
543
544 ALTER TABLE ONLY messprogramm_mmt
545 ADD CONSTRAINT messprogramm_mmt_pkey PRIMARY KEY (id);
546
547
548 --
549 -- Name: messung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
550 --
551
552 ALTER TABLE ONLY messung
553 ADD CONSTRAINT messung_pkey PRIMARY KEY (id);
554
555
556 --
557 -- Name: messwert_messungs_id_messgroesse_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace: 525 -- Name: messwert_messungs_id_messgroesse_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
558 -- 526 --
559 527
560 ALTER TABLE ONLY messwert 528 ALTER TABLE ONLY messwert
561 ADD CONSTRAINT messwert_messungs_id_messgroesse_id_key UNIQUE (messungs_id, messgroesse_id); 529 ADD CONSTRAINT messwert_messungs_id_messgroesse_id_key UNIQUE (messungs_id, messgroesse_id);
562 530
563 531
564 -- 532 --
565 -- Name: messwert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
566 --
567
568 ALTER TABLE ONLY messwert
569 ADD CONSTRAINT messwert_pkey PRIMARY KEY (id);
570
571
572 --
573 -- Name: ortszuordnung_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
574 --
575
576 ALTER TABLE ONLY ortszuordnung
577 ADD CONSTRAINT ortszuordnung_pkey PRIMARY KEY (id);
578
579
580 --
581 -- Name: status_protokoll_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
582 --
583
584 ALTER TABLE ONLY status_protokoll
585 ADD CONSTRAINT status_protokoll_pkey PRIMARY KEY (id);
586
587
588 --
589 -- Name: zusatz_wert_pkey; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
590 --
591
592 ALTER TABLE ONLY zusatz_wert
593 ADD CONSTRAINT zusatz_wert_pkey PRIMARY KEY (id);
594
595
596 --
597 -- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace: 533 -- Name: zusatz_wert_probe_id_pzs_id_key; Type: CONSTRAINT; Schema: land; Owner: -; Tablespace:
598 -- 534 --
599 535
600 ALTER TABLE ONLY zusatz_wert 536 ALTER TABLE ONLY zusatz_wert
601 ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id); 537 ADD CONSTRAINT zusatz_wert_probe_id_pzs_id_key UNIQUE (probe_id, pzs_id);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)