comparison flys-backend/doc/schema/postgresql.sql @ 1203:3c01bef43a98

Querprofile: Added a table to map the points to a given km. flys-backend/trunk@2308 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 07 Jul 2011 15:59:24 +0000
parents 44581b40b968
children 5f1506fc7636
comparison
equal deleted inserted replaced
1202:44581b40b968 1203:3c01bef43a98
264 264
265 CREATE SEQUENCE CROSS_SECTIONS_ID_SEQ; 265 CREATE SEQUENCE CROSS_SECTIONS_ID_SEQ;
266 266
267 CREATE TABLE cross_sections ( 267 CREATE TABLE cross_sections (
268 id int PRIMARY KEY NOT NULL, 268 id int PRIMARY KEY NOT NULL,
269 river_id int NOT NULL REFERENCES rivers(id),
270 time_interval_id int REFERENCES time_intervals(id),
271 description VARCHAR(256)
272 );
273
274 CREATE SEQUENCE CROSS_SECTION_LINES_SEQ;
275
276 CREATE TABLE cross_section_lines (
277 id int PRIMARY KEY NOT NULL,
269 km NUMERIC NOT NULL, 278 km NUMERIC NOT NULL,
270 river_id int NOT NULL REFERENCES rivers(id), 279 cross_section_id int NOT NULL REFERENCES cross_sections(id),
271 time_interval_id int REFERENCES time_intervals(id), 280 UNIQUE (km, cross_section_id)
272 description VARCHAR(256)
273 ); 281 );
274 282
275 CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; 283 CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ;
276 284
277 CREATE TABLE cross_section_points ( 285 CREATE TABLE cross_section_points (
278 id int PRIMARY KEY NOT NULL, 286 id int PRIMARY KEY NOT NULL,
279 cross_section_id int NOT NULL REFERENCES cross_sections(id), 287 cross_section_line_id int NOT NULL REFERENCES cross_section_lines(id),
280 col_pos int NOT NULL, 288 col_pos int NOT NULL,
281 x NUMERIC NOT NULL, 289 x NUMERIC NOT NULL,
282 y NUMERIC NOT NULL 290 y NUMERIC NOT NULL,
283 UNIQUE (cross_section_id, col_pos) 291 UNIQUE (cross_section_line_id, col_pos)
284 ); 292 );
285 293
286 COMMIT; 294 COMMIT;

http://dive4elements.wald.intevation.org