Mercurial > lada > lada-server
comparison db_schema/stammdaten_schema.sql @ 1022:042437ce8f51 schema-update
Added filter and query type table.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 04 Jul 2016 14:18:42 +0200 |
parents | 178ac8ee17c0 |
children | 5fdc6feabedb |
comparison
equal
deleted
inserted
replaced
1021:f51a9cf1d52c | 1022:042437ce8f51 |
---|---|
269 | 269 |
270 | 270 |
271 CREATE TABLE query ( | 271 CREATE TABLE query ( |
272 id serial PRIMARY KEY, | 272 id serial PRIMARY KEY, |
273 name character varying(80) NOT NULL, | 273 name character varying(80) NOT NULL, |
274 type character varying(30) NOT NULL, | 274 type integer NOT NULL REFERENCES query_type, |
275 sql character varying(1500) NOT NULL, | 275 sql character varying(1500) NOT NULL, |
276 description character varying(100) | 276 description character varying(100) |
277 ); | 277 ); |
278 | 278 |
279 CREATE TABLE query_type ( | |
280 id serial PRIMARY KEY, | |
281 type character varying(30) NOT NULL | |
282 ): | |
283 INSERT INTO query_type VALUES(0, 'probe'); | |
284 INSERT INTO query_type VALUES(1, 'messung'); | |
285 INSERT INTO query_type VALUES(2, 'messprogramm'); | |
286 INSERT INTO query_type VALUES(3, 'ort'); | |
287 INSERT INTO query_type VALUES(4, 'probenehmer'); | |
288 INSERT INTO query_type VALUES(5, 'datensatz_erzeuger'); | |
289 INSERT INTO query_type VALUES(6, 'messprogramm_kategorie'); | |
290 | |
279 | 291 |
280 CREATE TABLE favorite ( | 292 CREATE TABLE favorite ( |
281 id serial PRIMARY KEY, | 293 id serial PRIMARY KEY, |
282 user_id integer NOT NULL REFERENCES lada_user, | 294 user_id integer NOT NULL REFERENCES lada_user, |
283 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE | 295 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE |
286 | 298 |
287 CREATE TABLE filter ( | 299 CREATE TABLE filter ( |
288 id serial PRIMARY KEY, | 300 id serial PRIMARY KEY, |
289 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE, | 301 query_id integer NOT NULL REFERENCES query ON DELETE CASCADE, |
290 data_index character varying(50) NOT NULL, | 302 data_index character varying(50) NOT NULL, |
291 type character varying(10) NOT NULL, | 303 type integer NOT NULL REFERENCES filter_type, |
292 label character varying(50) NOT NULL, | 304 label character varying(50) NOT NULL, |
293 multiselect boolean | 305 multiselect boolean |
294 ); | 306 ); |
307 | |
308 | |
309 CREATE TABLE filter_type ( | |
310 id serial PRIMARY KEY, | |
311 type character varying(10) NOT NULL | |
312 ) | |
313 INSERT INTO filter_type VALUES(0, 'text'); | |
314 INSERT INTO filter_type VALUES(0, 'listmst'); | |
315 INSERT INTO filter_type VALUES(0, 'listnetz'); | |
316 INSERT INTO filter_type VALUES(0, 'listumw'); | |
317 INSERT INTO filter_type VALUES(0, 'liststatus'); | |
295 | 318 |
296 | 319 |
297 CREATE TABLE filter_value ( | 320 CREATE TABLE filter_value ( |
298 id serial PRIMARY KEY, | 321 id serial PRIMARY KEY, |
299 user_id integer NOT NULL REFERENCES lada_user, | 322 user_id integer NOT NULL REFERENCES lada_user, |