comparison backend/doc/schema/postgresql.sql @ 7352:c6825778de1f

Merged double-precision branch.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 16 Oct 2013 13:03:13 +0200
parents dddf633fec05
children 44a9233c62eb
comparison
equal deleted inserted replaced
7350:760ea7f08455 7352:c6825778de1f
32 CREATE TABLE ranges ( 32 CREATE TABLE ranges (
33 id int PRIMARY KEY NOT NULL, 33 id int PRIMARY KEY NOT NULL,
34 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE, 34 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
35 a NUMERIC NOT NULL, 35 a NUMERIC NOT NULL,
36 b NUMERIC, 36 b NUMERIC,
37 UNIQUE (river_id, a, b) 37 UNIQUE (river_id, a, b),
38 CHECK (a < b)
38 ); 39 );
39 40
40 41
41 -- Lage 'links', 'rechts', etc. 42 -- Lage 'links', 'rechts', etc.
42 CREATE SEQUENCE POSITIONS_ID_SEQ; 43 CREATE SEQUENCE POSITIONS_ID_SEQ;
89 official_number int8, 90 official_number int8,
90 91
91 -- Pegelnullpunkt 92 -- Pegelnullpunkt
92 datum NUMERIC NOT NULL, 93 datum NUMERIC NOT NULL,
93 -- Streckengueltigkeit 94 -- Streckengueltigkeit
94 range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE, 95 range_id int REFERENCES ranges (id) ON DELETE CASCADE,
95 96
96 UNIQUE (name, river_id), 97 UNIQUE (name, river_id),
97 UNIQUE (official_number, river_id), 98 UNIQUE (official_number, river_id),
98 UNIQUE (river_id, station) 99 UNIQUE (river_id, station)
99 ); 100 );
199 CREATE TABLE wst_columns ( 200 CREATE TABLE wst_columns (
200 id int PRIMARY KEY NOT NULL, 201 id int PRIMARY KEY NOT NULL,
201 wst_id int NOT NULL REFERENCES wsts(id) ON DELETE CASCADE, 202 wst_id int NOT NULL REFERENCES wsts(id) ON DELETE CASCADE,
202 name VARCHAR(256) NOT NULL, 203 name VARCHAR(256) NOT NULL,
203 description VARCHAR(256), 204 description VARCHAR(256),
205 source VARCHAR(256),
204 position int NOT NULL DEFAULT 0, 206 position int NOT NULL DEFAULT 0,
205 207
206 time_interval_id int REFERENCES time_intervals(id), 208 time_interval_id int REFERENCES time_intervals(id),
207 209
208 UNIQUE (wst_id, name), 210 UNIQUE (wst_id, name),
322 CREATE TABLE cross_section_points ( 324 CREATE TABLE cross_section_points (
323 id int PRIMARY KEY NOT NULL, 325 id int PRIMARY KEY NOT NULL,
324 cross_section_line_id int NOT NULL REFERENCES cross_section_lines(id) ON DELETE CASCADE, 326 cross_section_line_id int NOT NULL REFERENCES cross_section_lines(id) ON DELETE CASCADE,
325 col_pos int NOT NULL, 327 col_pos int NOT NULL,
326 x NUMERIC NOT NULL, 328 x NUMERIC NOT NULL,
327 y NUMERIC NOT NULL, 329 y NUMERIC NOT NULL
328 ); 330 );
329 331
330 -- Indices for faster access of the points 332 -- Indices for faster access of the points
331 CREATE INDEX cross_section_lines_km_idx 333 CREATE INDEX cross_section_lines_km_idx
332 ON cross_section_lines(km); 334 ON cross_section_lines(km);

http://dive4elements.wald.intevation.org