comparison backend/doc/schema/oracle-minfo.sql @ 7461:5b5a2cc8210f

Schema change: add lookup table for sediment yield kinds to have its values documented.
author Tom Gottfried <tom@intevation.de>
date Tue, 29 Oct 2013 19:59:59 +0100
parents c14e17dabf39
children 082284c4e0ad
comparison
equal deleted inserted replaced
7460:2733b4aae74b 7461:5b5a2cc8210f
248 lower NUMBER(38,3), 248 lower NUMBER(38,3),
249 upper NUMBER(38,3), 249 upper NUMBER(38,3),
250 PRIMARY KEY (id) 250 PRIMARY KEY (id)
251 ); 251 );
252 252
253 --lookup table for sediment yield kinds
254 CREATE TABLE sediment_yield_kinds (
255 id int PRIMARY KEY NOT NULL,
256 kind VARCHAR(64) NOT NULL
257 );
258 INSERT INTO sediment_yield_kinds (id, kind) VALUES (0, 'non-official');
259 INSERT INTO sediment_yield_kinds (id, kind) VALUES (1, 'official');
253 260
254 CREATE SEQUENCE SEDIMENT_YIELD_ID_SEQ; 261 CREATE SEQUENCE SEDIMENT_YIELD_ID_SEQ;
255 262
256 CREATE TABLE sediment_yield ( 263 CREATE TABLE sediment_yield (
257 id NUMBER(38,0) NOT NULL, 264 id NUMBER(38,0) NOT NULL,
261 time_interval_id NUMBER(38,0) NOT NULL, 268 time_interval_id NUMBER(38,0) NOT NULL,
262 description VARCHAR(256), 269 description VARCHAR(256),
263 kind NUMBER(38,0), 270 kind NUMBER(38,0),
264 PRIMARY KEY (id), 271 PRIMARY KEY (id),
265 CONSTRAINT fk_sy_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, 272 CONSTRAINT fk_sy_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
273 CONSTRAINT fk_sy_kind_id FOREIGN KEY (kind) REFERENCES sediment_yield_kinds(id),
266 CONSTRAINT fk_sy_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id), 274 CONSTRAINT fk_sy_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id),
267 CONSTRAINT fk_sy_unit_id FOREIGN KEY (unit_id) REFERENCES units(id), 275 CONSTRAINT fk_sy_unit_id FOREIGN KEY (unit_id) REFERENCES units(id),
268 CONSTRAINT fk_sy_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id) 276 CONSTRAINT fk_sy_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id)
269 ); 277 );
270 278

http://dive4elements.wald.intevation.org