comparison db_schema/stammdaten_schema.sql @ 1014:6b204c617c1f schema-update

Replaced explicid sequences with serials.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 04 Jul 2016 11:46:42 +0200
parents 48c07fc5d2d1
children 9f903c54141b
comparison
equal deleted inserted replaced
1013:48c07fc5d2d1 1014:6b204c617c1f
83 return (result); 83 return (result);
84 end; 84 end;
85 $$; 85 $$;
86 86
87 87
88 CREATE SEQUENCE staat_id_seq
89 START WITH 1
90 INCREMENT BY 1
91 NO MINVALUE
92 NO MAXVALUE
93 CACHE 1;
94
95 CREATE TABLE staat ( 88 CREATE TABLE staat (
96 id integer PRIMARY KEY DEFAULT nextval('staat_id_seq'::regclass), 89 id serial PRIMARY KEY,
97 staat character varying(50) NOT NULL, 90 staat character varying(50) NOT NULL,
98 hkl_id smallint NOT NULL, 91 hkl_id smallint NOT NULL,
99 staat_iso character varying(2) NOT NULL, 92 staat_iso character varying(2) NOT NULL,
100 staat_kurz character varying(5), 93 staat_kurz character varying(5),
101 eu character(1) DEFAULT NULL::bpchar, 94 eu character(1) DEFAULT NULL::bpchar,
102 koord_x_extern character varying(22), 95 koord_x_extern character varying(22),
103 koord_y_extern character varying(22), 96 koord_y_extern character varying(22),
104 kda_id integer 97 kda_id integer
105 ); 98 );
106
107 ALTER SEQUENCE staat_id_seq OWNED BY staat.id;
108 99
109 100
110 CREATE TABLE verwaltungseinheit ( 101 CREATE TABLE verwaltungseinheit (
111 id character varying(8) PRIMARY KEY, 102 id character varying(8) PRIMARY KEY,
112 bundesland character varying(8) NOT NULL, 103 bundesland character varying(8) NOT NULL,
145 mst_typ character varying(1), 136 mst_typ character varying(1),
146 amtskennung character varying(6) 137 amtskennung character varying(6)
147 ); 138 );
148 139
149 140
150 CREATE SEQUENCE auth_id_seq
151 START WITH 1
152 INCREMENT BY 1
153 NO MINVALUE
154 NO MAXVALUE
155 CACHE 1;
156
157 CREATE TABLE auth ( 141 CREATE TABLE auth (
158 id integer PRIMARY KEY DEFAULT nextval('auth_id_seq'::regclass), 142 id serial PRIMARY KEY,
159 ldap_group character varying(40) NOT NULL, 143 ldap_group character varying(40) NOT NULL,
160 netzbetreiber_id character varying(2), 144 netzbetreiber_id character varying(2),
161 mst_id character varying(5), 145 mst_id character varying(5),
162 labor_mst_id character varying(5), 146 labor_mst_id character varying(5),
163 funktion_id smallint 147 funktion_id smallint
164 ); 148 );
165 149
166 ALTER SEQUENCE auth_id_seq OWNED BY auth.id;
167
168 150
169 CREATE TABLE auth_funktion ( 151 CREATE TABLE auth_funktion (
170 id smallint PRIMARY KEY, 152 id smallint PRIMARY KEY,
171 funktion character varying(40) UNIQUE NOT NULL 153 funktion character varying(40) UNIQUE NOT NULL
172 ); 154 );
175 INSERT INTO auth_funktion VALUES (2, 'Status-Land'); 157 INSERT INTO auth_funktion VALUES (2, 'Status-Land');
176 INSERT INTO auth_funktion VALUES (3, 'Status-Leitstelle'); 158 INSERT INTO auth_funktion VALUES (3, 'Status-Leitstelle');
177 INSERT INTO auth_funktion VALUES (4, 'Stammdatenpflege-Land'); 159 INSERT INTO auth_funktion VALUES (4, 'Stammdatenpflege-Land');
178 160
179 161
180 CREATE SEQUENCE auth_lst_umw_id_seq
181 START WITH 1
182 INCREMENT BY 1
183 NO MINVALUE
184 NO MAXVALUE
185 CACHE 1;
186
187 CREATE TABLE auth_lst_umw ( 162 CREATE TABLE auth_lst_umw (
188 id integer PRIMARY KEY DEFAULT nextval('auth_lst_umw_id_seq'::regclass), 163 id serial PRIMARY KEY,
189 mst_id character varying(5), 164 mst_id character varying(5),
190 umw_id character varying(3) 165 umw_id character varying(3)
191 ); 166 );
192 167
193 ALTER SEQUENCE auth_lst_umw_id_seq OWNED BY auth_lst_umw.id;
194
195
196 CREATE SEQUENCE datenbasis_id_seq
197 START WITH 1
198 INCREMENT BY 1
199 NO MINVALUE
200 NO MAXVALUE
201 CACHE 1;
202 168
203 CREATE TABLE datenbasis ( 169 CREATE TABLE datenbasis (
204 id integer PRIMARY KEY DEFAULT nextval('datenbasis_id_seq'::regclass), 170 id serial PRIMARY KEY,
205 beschreibung character varying(30), 171 beschreibung character varying(30),
206 datenbasis character varying(6) 172 datenbasis character varying(6)
207 ); 173 );
208 174
209 ALTER SEQUENCE datenbasis_id_seq OWNED BY datenbasis.id;
210
211
212 CREATE SEQUENCE datensatz_erzeuger_id_seq
213 START WITH 1
214 INCREMENT BY 1
215 NO MINVALUE
216 NO MAXVALUE
217 CACHE 1;
218 175
219 CREATE TABLE datensatz_erzeuger ( 176 CREATE TABLE datensatz_erzeuger (
220 id integer PRIMARY KEY 177 id serial PRIMARY KEY,
221 DEFAULT nextval('datensatz_erzeuger_id_seq'::regclass),
222 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, 178 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber,
223 datensatz_erzeuger_id character varying(2) NOT NULL, 179 datensatz_erzeuger_id character varying(2) NOT NULL,
224 mst_id character varying(5) NOT NULL REFERENCES mess_stelle, 180 mst_id character varying(5) NOT NULL REFERENCES mess_stelle,
225 bezeichnung character varying(120) NOT NULL, 181 bezeichnung character varying(120) NOT NULL,
226 letzte_aenderung timestamp without time zone, 182 letzte_aenderung timestamp without time zone,
227 UNIQUE(datensatz_erzeuger_id, netzbetreiber_id) 183 UNIQUE(datensatz_erzeuger_id, netzbetreiber_id)
228 ); 184 );
229 CREATE TRIGGER letzte_aenderung_datensatz_erzeuger BEFORE UPDATE ON datensatz_erzeuger FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 185 CREATE TRIGGER letzte_aenderung_datensatz_erzeuger BEFORE UPDATE ON datensatz_erzeuger FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
230 186
231 ALTER SEQUENCE datensatz_erzeuger_id_seq OWNED BY datensatz_erzeuger.id;
232
233
234 CREATE SEQUENCE de_vg_id_seq
235 START WITH 1
236 INCREMENT BY 1
237 NO MINVALUE
238 NO MAXVALUE
239 CACHE 1;
240 187
241 CREATE TABLE de_vg ( 188 CREATE TABLE de_vg (
242 id integer PRIMARY KEY DEFAULT nextval('de_vg_id_seq'::regclass), 189 id serial PRIMARY KEY,
243 use double precision, 190 use double precision,
244 rs character varying(12), 191 rs character varying(12),
245 gf double precision, 192 gf double precision,
246 rau_rs character varying(12), 193 rau_rs character varying(12),
247 gen character varying(50), 194 gen character varying(50),
256 length numeric, 203 length numeric,
257 shape_area numeric, 204 shape_area numeric,
258 geom public.geometry(MultiPolygon,4326) 205 geom public.geometry(MultiPolygon,4326)
259 ); 206 );
260 207
261 ALTER SEQUENCE de_vg_id_seq OWNED BY de_vg.id;
262
263 208
264 CREATE TABLE deskriptor_umwelt ( 209 CREATE TABLE deskriptor_umwelt (
265 id integer PRIMARY KEY, 210 id integer PRIMARY KEY,
266 s00 integer NOT NULL, 211 s00 integer NOT NULL,
267 s01 integer NOT NULL, 212 s01 integer NOT NULL,
278 s12 integer, 223 s12 integer,
279 umw_id character varying(3) NOT NULL 224 umw_id character varying(3) NOT NULL
280 ); 225 );
281 226
282 227
283 CREATE SEQUENCE deskriptoren_id_seq
284 START WITH 1
285 INCREMENT BY 1
286 NO MINVALUE
287 NO MAXVALUE
288 CACHE 1;
289
290 CREATE TABLE deskriptoren ( 228 CREATE TABLE deskriptoren (
291 id integer PRIMARY KEY DEFAULT nextval('deskriptoren_id_seq'::regclass), 229 id serial PRIMARY KEY,
292 vorgaenger integer, 230 vorgaenger integer,
293 ebene smallint, 231 ebene smallint,
294 s_xx integer, 232 s_xx integer,
295 sn smallint, 233 sn smallint,
296 beschreibung character varying(100), 234 beschreibung character varying(100),
297 bedeutung character varying(300) 235 bedeutung character varying(300)
298 ); 236 );
299 237
300 ALTER SEQUENCE deskriptoren_id_seq OWNED BY deskriptoren.id;
301
302
303 CREATE SEQUENCE lada_user_id_seq
304 START WITH 1
305 INCREMENT BY 1
306 NO MINVALUE
307 NO MAXVALUE
308 CACHE 1;
309 238
310 CREATE TABLE lada_user ( 239 CREATE TABLE lada_user (
311 id integer PRIMARY KEY DEFAULT nextval('lada_user_id_seq'::regclass), 240 id serial PRIMARY KEY,
312 name character varying(80) NOT NULL 241 name character varying(80) NOT NULL
313 ); 242 );
314 243
315 ALTER SEQUENCE lada_user_id_seq OWNED BY lada_user.id;
316
317
318 CREATE SEQUENCE query_id_seq
319 START WITH 1
320 INCREMENT BY 1
321 NO MINVALUE
322 NO MAXVALUE
323 CACHE 1;
324 244
325 CREATE TABLE query ( 245 CREATE TABLE query (
326 id integer PRIMARY KEY DEFAULT nextval('query_id_seq'::regclass), 246 id serial PRIMARY KEY,
327 name character varying(80) NOT NULL, 247 name character varying(80) NOT NULL,
328 type character varying(30) NOT NULL, 248 type character varying(30) NOT NULL,
329 sql character varying(1500) NOT NULL, 249 sql character varying(1500) NOT NULL,
330 description character varying(100) 250 description character varying(100)
331 ); 251 );
332 252
333 ALTER SEQUENCE query_id_seq OWNED BY query.id;
334
335
336 CREATE SEQUENCE favorite_id_seq
337 START WITH 1
338 INCREMENT BY 1
339 NO MINVALUE
340 NO MAXVALUE
341 CACHE 1;
342 253
343 CREATE TABLE favorite ( 254 CREATE TABLE favorite (
344 id integer PRIMARY KEY DEFAULT nextval('favorite_id_seq'::regclass), 255 id serial PRIMARY KEY,
345 user_id integer NOT NULL REFERENCES lada_user, 256 user_id integer NOT NULL REFERENCES lada_user,
346 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE 257 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE
347 ); 258 );
348 259
349 ALTER SEQUENCE favorite_id_seq OWNED BY favorite.id;
350
351
352 CREATE SEQUENCE filter_id_seq
353 START WITH 1
354 INCREMENT BY 1
355 NO MINVALUE
356 NO MAXVALUE
357 CACHE 1;
358 260
359 CREATE TABLE filter ( 261 CREATE TABLE filter (
360 id integer PRIMARY KEY DEFAULT nextval('filter_id_seq'::regclass), 262 id serial PRIMARY KEY,
361 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE, 263 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE,
362 data_index character varying(50) NOT NULL, 264 data_index character varying(50) NOT NULL,
363 type character varying(10) NOT NULL, 265 type character varying(10) NOT NULL,
364 label character varying(50) NOT NULL, 266 label character varying(50) NOT NULL,
365 multiselect boolean 267 multiselect boolean
366 ); 268 );
367 269
368 ALTER SEQUENCE filter_id_seq OWNED BY filter.id;
369
370
371 CREATE SEQUENCE filter_value_id_seq
372 START WITH 1
373 INCREMENT BY 1
374 NO MINVALUE
375 NO MAXVALUE
376 CACHE 1;
377 270
378 CREATE TABLE filter_value ( 271 CREATE TABLE filter_value (
379 id integer PRIMARY KEY DEFAULT nextval('filter_value_id_seq'::regclass), 272 id serial PRIMARY KEY,
380 user_id integer NOT NULL REFERENCES lada_user, 273 user_id integer NOT NULL REFERENCES lada_user,
381 filter_id integer NOT NULL REFERENCES filter ON DELETE CASCADE, 274 filter_id integer NOT NULL REFERENCES filter ON DELETE CASCADE,
382 value text 275 value text
383 ); 276 );
384 277
385 ALTER SEQUENCE filter_value_id_seq OWNED BY filter_value.id;
386
387
388 CREATE SEQUENCE koordinaten_art_id_seq
389 START WITH 1
390 INCREMENT BY 1
391 NO MINVALUE
392 NO MAXVALUE
393 CACHE 1;
394 278
395 CREATE TABLE koordinaten_art ( 279 CREATE TABLE koordinaten_art (
396 id integer PRIMARY KEY DEFAULT nextval('koordinaten_art_id_seq'::regclass), 280 id serial PRIMARY KEY,
397 koordinatenart character varying(50), 281 koordinatenart character varying(50),
398 idf_geo_key character varying(1) 282 idf_geo_key character varying(1)
399 ); 283 );
400 284
401 ALTER SEQUENCE koordinaten_art_id_seq OWNED BY koordinaten_art.id;
402
403
404 CREATE SEQUENCE mess_einheit_id_seq
405 START WITH 1
406 INCREMENT BY 1
407 NO MINVALUE
408 NO MAXVALUE
409 CACHE 1;
410 285
411 CREATE TABLE mess_einheit ( 286 CREATE TABLE mess_einheit (
412 id integer PRIMARY KEY DEFAULT nextval('mess_einheit_id_seq'::regclass), 287 id serial PRIMARY KEY,
413 beschreibung character varying(50), 288 beschreibung character varying(50),
414 einheit character varying(12), 289 einheit character varying(12),
415 eudf_messeinheit_id character varying(8), 290 eudf_messeinheit_id character varying(8),
416 umrechnungs_faktor_eudf bigint 291 umrechnungs_faktor_eudf bigint
417 ); 292 );
418 293
419 ALTER SEQUENCE mess_einheit_id_seq OWNED BY mess_einheit.id;
420
421 294
422 CREATE TABLE mess_methode ( 295 CREATE TABLE mess_methode (
423 id character varying(2) PRIMARY KEY, 296 id character varying(2) PRIMARY KEY,
424 beschreibung character varying(300), 297 beschreibung character varying(300),
425 messmethode character varying(50) 298 messmethode character varying(50)
426 ); 299 );
427 300
428 301
429 CREATE SEQUENCE messgroesse_id_seq
430 START WITH 1
431 INCREMENT BY 1
432 NO MINVALUE
433 NO MAXVALUE
434 CACHE 1;
435
436 CREATE TABLE messgroesse ( 302 CREATE TABLE messgroesse (
437 id integer PRIMARY KEY DEFAULT nextval('messgroesse_id_seq'::regclass), 303 id serial PRIMARY KEY,
438 beschreibung character varying(300), 304 beschreibung character varying(300),
439 messgroesse character varying(50) NOT NULL, 305 messgroesse character varying(50) NOT NULL,
440 default_farbe character varying(9), 306 default_farbe character varying(9),
441 idf_nuklid_key character varying(6), 307 idf_nuklid_key character varying(6),
442 ist_leitnuklid boolean DEFAULT false, 308 ist_leitnuklid boolean DEFAULT false,
443 eudf_nuklid_id bigint, 309 eudf_nuklid_id bigint,
444 kennung_bvl character varying(7) 310 kennung_bvl character varying(7)
445 ); 311 );
446 312
447 ALTER SEQUENCE messgroesse_id_seq OWNED BY messgroesse.id;
448
449
450 CREATE SEQUENCE messgroessen_gruppe_id_seq
451 START WITH 1
452 INCREMENT BY 1
453 NO MINVALUE
454 NO MAXVALUE
455 CACHE 1;
456 313
457 CREATE TABLE messgroessen_gruppe ( 314 CREATE TABLE messgroessen_gruppe (
458 id integer PRIMARY KEY 315 id serial PRIMARY KEY,
459 DEFAULT nextval('messgroessen_gruppe_id_seq'::regclass),
460 bezeichnung character varying(80), 316 bezeichnung character varying(80),
461 ist_leitnuklidgruppe character(1) DEFAULT NULL::bpchar 317 ist_leitnuklidgruppe character(1) DEFAULT NULL::bpchar
462 ); 318 );
463 319
464 ALTER SEQUENCE messgroessen_gruppe_id_seq OWNED BY messgroessen_gruppe.id;
465
466
467 CREATE SEQUENCE messprogramm_kategorie_id_seq
468 START WITH 1
469 INCREMENT BY 1
470 NO MINVALUE
471 NO MAXVALUE
472 CACHE 1;
473 320
474 CREATE TABLE messprogramm_kategorie ( 321 CREATE TABLE messprogramm_kategorie (
475 id integer PRIMARY KEY 322 id serial PRIMARY KEY,
476 DEFAULT nextval('messprogramm_kategorie_id_seq'::regclass),
477 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, 323 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber,
478 code character varying(3) NOT NULL, 324 code character varying(3) NOT NULL,
479 bezeichnung character varying(120) NOT NULL, 325 bezeichnung character varying(120) NOT NULL,
480 letzte_aenderung timestamp without time zone, 326 letzte_aenderung timestamp without time zone,
481 UNIQUE(code, netzbetreiber_id) 327 UNIQUE(code, netzbetreiber_id)
482 ); 328 );
483 CREATE TRIGGER letzte_aenderung_messprogramm_kategorie BEFORE UPDATE ON messprogramm_kategorie FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 329 CREATE TRIGGER letzte_aenderung_messprogramm_kategorie BEFORE UPDATE ON messprogramm_kategorie FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
484
485 ALTER SEQUENCE messprogramm_kategorie_id_seq
486 OWNED BY messprogramm_kategorie.id;
487 330
488 331
489 CREATE TABLE mg_grp ( 332 CREATE TABLE mg_grp (
490 messgroessengruppe_id integer NOT NULL, 333 messgroessengruppe_id integer NOT NULL,
491 messgroesse_id integer NOT NULL 334 messgroesse_id integer NOT NULL
510 id smallint PRIMARY KEY, 353 id smallint PRIMARY KEY,
511 ort_typ character varying(60) 354 ort_typ character varying(60)
512 ); 355 );
513 356
514 357
515 CREATE SEQUENCE ort_id_seq
516 START WITH 1
517 INCREMENT BY 1
518 NO MINVALUE
519 NO MAXVALUE
520 CACHE 1;
521
522 CREATE TABLE ort ( 358 CREATE TABLE ort (
523 id integer PRIMARY KEY DEFAULT nextval('ort_id_seq'::regclass), 359 id serial PRIMARY KEY,
524 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, 360 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber,
525 ort_id character varying(10) NOT NULL, 361 ort_id character varying(10) NOT NULL,
526 langtext character varying(100) NOT NULL, 362 langtext character varying(100) NOT NULL,
527 staat_id smallint NOT NULL REFERENCES staat, 363 staat_id smallint NOT NULL REFERENCES staat,
528 gem_id character varying(8) REFERENCES verwaltungseinheit, 364 gem_id character varying(8) REFERENCES verwaltungseinheit,
555 ADD CONSTRAINT ort_anlage_fkey FOREIGN KEY (anlage_id) REFERENCES ort(id); 391 ADD CONSTRAINT ort_anlage_fkey FOREIGN KEY (anlage_id) REFERENCES ort(id);
556 392
557 ALTER TABLE ONLY ort 393 ALTER TABLE ONLY ort
558 ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id); 394 ADD CONSTRAINT ort_oz_fkey FOREIGN KEY (oz_id) REFERENCES ort(id);
559 395
560 ALTER SEQUENCE ort_id_seq OWNED BY ort.id;
561
562 396
563 CREATE TABLE ortszuordnung_typ ( 397 CREATE TABLE ortszuordnung_typ (
564 id character(1) PRIMARY KEY, 398 id character(1) PRIMARY KEY,
565 ortstyp character varying(60) 399 ortstyp character varying(60)
566 ); 400 );
567 401
568 402
569 CREATE SEQUENCE pflicht_messgroesse_id_seq
570 START WITH 1
571 INCREMENT BY 1
572 NO MINVALUE
573 NO MAXVALUE
574 CACHE 1;
575
576 CREATE TABLE pflicht_messgroesse ( 403 CREATE TABLE pflicht_messgroesse (
577 id integer PRIMARY KEY 404 id serial PRIMARY KEY,
578 DEFAULT nextval('pflicht_messgroesse_id_seq'::regclass),
579 messgroesse_id integer, 405 messgroesse_id integer,
580 mmt_id character varying(2), 406 mmt_id character varying(2),
581 umw_id character varying(3), 407 umw_id character varying(3),
582 datenbasis_id smallint NOT NULL 408 datenbasis_id smallint NOT NULL
583 ); 409 );
584
585 ALTER SEQUENCE pflicht_messgroesse_id_seq OWNED BY pflicht_messgroesse.id;
586 410
587 411
588 CREATE TABLE proben_zusatz ( 412 CREATE TABLE proben_zusatz (
589 id character varying(3) PRIMARY KEY, 413 id character varying(3) PRIMARY KEY,
590 meh_id integer, 414 meh_id integer,
592 zusatzwert character varying(7) NOT NULL, 416 zusatzwert character varying(7) NOT NULL,
593 eudf_keyword character varying(40) 417 eudf_keyword character varying(40)
594 ); 418 );
595 419
596 420
597 CREATE SEQUENCE probenart_id_seq
598 START WITH 1
599 INCREMENT BY 1
600 NO MINVALUE
601 NO MAXVALUE
602 CACHE 1;
603
604 CREATE TABLE probenart ( 421 CREATE TABLE probenart (
605 id integer PRIMARY KEY DEFAULT nextval('probenart_id_seq'::regclass), 422 id serial PRIMARY KEY,
606 beschreibung character varying(30), 423 beschreibung character varying(30),
607 probenart character varying(5) NOT NULL, 424 probenart character varying(5) NOT NULL,
608 probenart_eudf_id character varying(1) NOT NULL 425 probenart_eudf_id character varying(1) NOT NULL
609 ); 426 );
610 427
611 ALTER SEQUENCE probenart_id_seq OWNED BY probenart.id;
612
613
614 CREATE SEQUENCE probenehmer_id_seq
615 START WITH 1
616 INCREMENT BY 1
617 NO MINVALUE
618 NO MAXVALUE
619 CACHE 1;
620 428
621 CREATE TABLE probenehmer ( 429 CREATE TABLE probenehmer (
622 id integer PRIMARY KEY DEFAULT nextval('probenehmer_id_seq'::regclass), 430 id serial PRIMARY KEY,
623 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber, 431 netzbetreiber_id character varying(2) NOT NULL REFERENCES netz_betreiber,
624 prn_id character varying(9) NOT NULL, 432 prn_id character varying(9) NOT NULL,
625 bearbeiter character varying(25), 433 bearbeiter character varying(25),
626 bemerkung character varying(60), 434 bemerkung character varying(60),
627 betrieb character varying(80), 435 betrieb character varying(80),
636 letzte_aenderung timestamp without time zone, 444 letzte_aenderung timestamp without time zone,
637 UNIQUE(prn_id, netzbetreiber_id) 445 UNIQUE(prn_id, netzbetreiber_id)
638 ); 446 );
639 CREATE TRIGGER letzte_aenderung_probenehmer BEFORE UPDATE ON probenehmer FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); 447 CREATE TRIGGER letzte_aenderung_probenehmer BEFORE UPDATE ON probenehmer FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung();
640 448
641 ALTER SEQUENCE probenehmer_id_seq OWNED BY probenehmer.id;
642
643
644 CREATE SEQUENCE result_id_seq
645 START WITH 1
646 INCREMENT BY 1
647 NO MINVALUE
648 NO MAXVALUE
649 CACHE 1;
650 449
651 CREATE TABLE result ( 450 CREATE TABLE result (
652 id integer PRIMARY KEY DEFAULT nextval('result_id_seq'::regclass), 451 id serial PRIMARY KEY,
653 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE, 452 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE,
654 data_index character varying(50) NOT NULL, 453 data_index character varying(50) NOT NULL,
655 header character varying(50) NOT NULL, 454 header character varying(50) NOT NULL,
656 width integer, 455 width integer,
657 flex boolean, 456 flex boolean,
658 index integer, 457 index integer,
659 UNIQUE (query_id, data_index) 458 UNIQUE (query_id, data_index)
660 ); 459 );
661
662 ALTER SEQUENCE result_id_seq OWNED BY result.id;
663
664 460
665 461
666 -- Status workflow 462 -- Status workflow
667 CREATE TABLE status_stufe ( 463 CREATE TABLE status_stufe (
668 id integer PRIMARY KEY, 464 id integer PRIMARY KEY,
706 INSERT INTO status_kombi VALUES (11, 3, 2); 502 INSERT INTO status_kombi VALUES (11, 3, 2);
707 INSERT INTO status_kombi VALUES (12, 3, 3); 503 INSERT INTO status_kombi VALUES (12, 3, 3);
708 INSERT INTO status_kombi VALUES (13, 3, 4); 504 INSERT INTO status_kombi VALUES (13, 3, 4);
709 505
710 506
711 CREATE SEQUENCE status_reihenfolge_id_seq;
712 CREATE TABLE status_reihenfolge ( 507 CREATE TABLE status_reihenfolge (
713 id integer PRIMARY KEY DEFAULT nextval('status_reihenfolge_id_seq'), 508 id serial PRIMARY KEY,
714 von_id integer REFERENCES status_kombi NOT NULL, 509 von_id integer REFERENCES status_kombi NOT NULL,
715 zu_id integer REFERENCES status_kombi NOT NULL, 510 zu_id integer REFERENCES status_kombi NOT NULL,
716 UNIQUE(von_id, zu_id) 511 UNIQUE(von_id, zu_id)
717 ); 512 );
718 513
784 umwelt_bereich character varying(80) NOT NULL, 579 umwelt_bereich character varying(80) NOT NULL,
785 meh_id integer 580 meh_id integer
786 ); 581 );
787 582
788 583
789
790
791 ALTER TABLE ONLY lada_user 584 ALTER TABLE ONLY lada_user
792 ADD CONSTRAINT lada_user_name_key UNIQUE (name); 585 ADD CONSTRAINT lada_user_name_key UNIQUE (name);
793 586
794 587
795 ALTER TABLE ONLY mg_grp 588 ALTER TABLE ONLY mg_grp
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)