comparison db_schema/stammdaten_schema.sql @ 1029:b29098d201c2 schema-update

Moved referenced tables.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 08 Jul 2016 15:34:33 +0200
parents 8e5dcf7156c5
children 330dec7ee0bb
comparison
equal deleted inserted replaced
1028:1c41c7b8f7c2 1029:b29098d201c2
274 name character varying(80) NOT NULL, 274 name character varying(80) NOT NULL,
275 UNIQUE (name) 275 UNIQUE (name)
276 ); 276 );
277 277
278 278
279 CREATE TABLE query (
280 id serial PRIMARY KEY,
281 name character varying(80) NOT NULL,
282 type integer NOT NULL REFERENCES query_type,
283 sql character varying(1500) NOT NULL,
284 description character varying(100)
285 );
286
287 CREATE TABLE query_type ( 279 CREATE TABLE query_type (
288 id serial PRIMARY KEY, 280 id serial PRIMARY KEY,
289 type character varying(30) NOT NULL 281 type character varying(30) NOT NULL
290 ): 282 );
291 INSERT INTO query_type VALUES(0, 'probe'); 283 INSERT INTO query_type VALUES(0, 'probe');
292 INSERT INTO query_type VALUES(1, 'messung'); 284 INSERT INTO query_type VALUES(1, 'messung');
293 INSERT INTO query_type VALUES(2, 'messprogramm'); 285 INSERT INTO query_type VALUES(2, 'messprogramm');
294 INSERT INTO query_type VALUES(3, 'ort'); 286 INSERT INTO query_type VALUES(3, 'ort');
295 INSERT INTO query_type VALUES(4, 'probenehmer'); 287 INSERT INTO query_type VALUES(4, 'probenehmer');
296 INSERT INTO query_type VALUES(5, 'datensatzerzeuger'); 288 INSERT INTO query_type VALUES(5, 'datensatzerzeuger');
297 INSERT INTO query_type VALUES(6, 'messprogrammkategorie'); 289 INSERT INTO query_type VALUES(6, 'messprogrammkategorie');
298 290
299 291
292 CREATE TABLE query (
293 id serial PRIMARY KEY,
294 name character varying(80) NOT NULL,
295 type integer NOT NULL REFERENCES query_type,
296 sql character varying(1500) NOT NULL,
297 description character varying(100)
298 );
299
300
300 CREATE TABLE favorite ( 301 CREATE TABLE favorite (
301 id serial PRIMARY KEY, 302 id serial PRIMARY KEY,
302 user_id integer NOT NULL REFERENCES lada_user, 303 user_id integer NOT NULL REFERENCES lada_user,
303 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE 304 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE
304 ); 305 );
306
307
308 CREATE TABLE filter_type (
309 id serial PRIMARY KEY,
310 type character varying(10) NOT NULL
311 );
312 INSERT INTO filter_type VALUES(0, 'text');
313 INSERT INTO filter_type VALUES(1, 'listmst');
314 INSERT INTO filter_type VALUES(2, 'listnetz');
315 INSERT INTO filter_type VALUES(3, 'listumw');
316 INSERT INTO filter_type VALUES(4, 'liststatus');
317 INSERT INTO filter_type VALUES(5, 'number');
305 318
306 319
307 CREATE TABLE filter ( 320 CREATE TABLE filter (
308 id serial PRIMARY KEY, 321 id serial PRIMARY KEY,
309 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE, 322 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE,
310 data_index character varying(50) NOT NULL, 323 data_index character varying(50) NOT NULL,
311 type integer NOT NULL REFERENCES filter_type, 324 type integer NOT NULL REFERENCES filter_type,
312 label character varying(50) NOT NULL, 325 label character varying(50) NOT NULL,
313 multiselect boolean 326 multiselect boolean
314 ); 327 );
315
316
317 CREATE TABLE filter_type (
318 id serial PRIMARY KEY,
319 type character varying(10) NOT NULL
320 )
321 INSERT INTO filter_type VALUES(0, 'text');
322 INSERT INTO filter_type VALUES(1, 'listmst');
323 INSERT INTO filter_type VALUES(2, 'listnetz');
324 INSERT INTO filter_type VALUES(3, 'listumw');
325 INSERT INTO filter_type VALUES(4, 'liststatus');
326 328
327 329
328 CREATE TABLE filter_value ( 330 CREATE TABLE filter_value (
329 id serial PRIMARY KEY, 331 id serial PRIMARY KEY,
330 user_id integer NOT NULL REFERENCES lada_user, 332 user_id integer NOT NULL REFERENCES lada_user,
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)