comparison flys-backend/doc/schema/postgresql.sql @ 5202:646c154477fe

SCHEMA CHANGE: removed Waterlevel and WaterleveDifferences, added lookup table for wst
author Tom Gottfried <tom@intevation.de>
date Fri, 08 Mar 2013 12:45:48 +0100
parents b79eb203032d
children 2919cdc4e858
comparison
equal deleted inserted replaced
5200:42bb6ff78d1b 5202:646c154477fe
164 164
165 UNIQUE (table_id, q, w) 165 UNIQUE (table_id, q, w)
166 ); 166 );
167 167
168 -- WST files 168 -- WST files
169 --lookup table for wst kinds
170 CREATE TABLE wst_kinds (
171 id int PRIMARY KEY NOT NULL,
172 kind VARCHAR(64) NOT NULL
173 );
174 INSERT INTO wst_kinds (id, kind) VALUES (0, 'basedata');
175 INSERT INTO wst_kinds (id, kind) VALUES (1, 'basedata_additionals_marks');
176 INSERT INTO wst_kinds (id, kind) VALUES (2, 'basedata_fixations_wst');
177 INSERT INTO wst_kinds (id, kind) VALUES (3, 'basedata_officials');
178 INSERT INTO wst_kinds (id, kind) VALUES (4, 'basedata_heightmarks-points-relative_points');
179 INSERT INTO wst_kinds (id, kind) VALUES (5, 'basedata_flood-protections_relative_points');
180 INSERT INTO wst_kinds (id, kind) VALUES (6, 'morpho_waterlevel-differences');
181 INSERT INTO wst_kinds (id, kind) VALUES (7, 'morpho_waterlevels');
182
183
169 CREATE SEQUENCE WSTS_ID_SEQ; 184 CREATE SEQUENCE WSTS_ID_SEQ;
170 185
171 CREATE TABLE wsts ( 186 CREATE TABLE wsts (
172 id int PRIMARY KEY NOT NULL, 187 id int PRIMARY KEY NOT NULL,
173 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE, 188 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
174 description VARCHAR(256) NOT NULL, 189 description VARCHAR(256) NOT NULL,
175 kind int NOT NULL DEFAULT 0, 190 kind int NOT NULL REFERENCES wst_kinds(id) DEFAULT 0,
176 -- TODO: more meta infos 191 -- TODO: more meta infos
177 UNIQUE (river_id, description) 192 UNIQUE (river_id, description)
178 ); 193 );
179 194
180 -- columns of WST files 195 -- columns of WST files

http://dive4elements.wald.intevation.org