Mercurial > dive4elements > river
changeset 5224:2594904640c3
SCHEMA CHANGE: analogue r5201. Here for Oracle
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 11 Mar 2013 18:17:12 +0100 |
parents | 54f2a56752a1 |
children | a075f26a516c |
files | flys-backend/doc/schema/oracle-minfo.sql flys-backend/doc/schema/oracle.sql |
diffstat | 2 files changed, 22 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-minfo.sql Mon Mar 11 17:25:18 2013 +0100 +++ b/flys-backend/doc/schema/oracle-minfo.sql Mon Mar 11 18:17:12 2013 +0100 @@ -20,15 +20,17 @@ CONSTRAINT fk_unit FOREIGN KEY (unit_id) REFERENCES units(id) ); -CREATE SEQUENCE BED_HEIGHT_TYPE_SEQ; +-- lookup table for bedheight types CREATE TABLE bed_height_type ( id NUMBER(38,0) NOT NULL, - name VARCHAR(16) NOT NULL, - description VARCHAR(255), + type VARCHAR(65) NOT NULL, PRIMARY KEY(id) ); - +INSERT INTO bed_height_type VALUES (1, 'Querprofil') +INSERT INTO bed_height_type VALUES (2, 'Flächenpeilung') +INSERT INTO bed_height_type VALUES (3, 'Flächen- u. Querprofilpeilungen') +INSERT INTO bed_height_type VALUES (4, 'DGM') CREATE SEQUENCE BED_HEIGHT_SINGLE_ID_SEQ; @@ -281,78 +283,6 @@ ); -CREATE SEQUENCE WATERLEVEL_ID_SEQ; - -CREATE TABLE waterlevel ( - id NUMBER(38,0) NOT NULL, - river_id NUMBER(38,0) NOT NULL, - unit_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_w_river_id FOREIGN KEY (river_id) REFERENCES rivers(id), - CONSTRAINT fk_w_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) -); - - -CREATE SEQUENCE WATERLEVEL_Q_RANGES_ID_SEQ; - -CREATE TABLE waterlevel_q_range ( - id NUMBER(38,0) NOT NULL, - waterlevel_id NUMBER(38,0) NOT NULL, - q NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wqr_waterlevel_id FOREIGN KEY (waterlevel_id) REFERENCES waterlevel(id) -); - - -CREATE SEQUENCE WATERLEVEL_VALUES_ID_SEQ; - -CREATE TABLE waterlevel_values ( - id NUMBER(38,0) NOT NULL, - waterlevel_q_range_id NUMBER(38,0) NOT NULL, - station NUMBER(38,3) NOT NULL, - w NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wv_waterlevel_q_range_id FOREIGN KEY (waterlevel_q_range_id) REFERENCES waterlevel_q_range(id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFFERENCE_ID_SEQ; - -CREATE TABLE waterlevel_difference ( - id NUMBER(38,0) NOT NULL, - river_id NUMBER(38,0) NOT NULL, - unit_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_wd_river_id FOREIGN KEY (river_id) REFERENCES rivers (id), - CONSTRAINT fk_wd_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFF_COLUMN_ID_SEQ; - -CREATE TABLE waterlevel_difference_column ( - id NUMBER(38,0) NOT NULL, - difference_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_wdc_difference_id FOREIGN KEY (difference_id) REFERENCES waterlevel_difference (id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFF_VALUES_ID_SEQ; - -CREATE TABLE waterlevel_difference_values ( - id NUMBER(38,0) NOT NULL, - column_id NUMBER(38,0) NOT NULL, - station NUMBER(38,3) NOT NULL, - value NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id) -); - - CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ; CREATE TABLE measurement_station ( id NUMBER(38) NOT NULL,
--- a/flys-backend/doc/schema/oracle.sql Mon Mar 11 17:25:18 2013 +0100 +++ b/flys-backend/doc/schema/oracle.sql Mon Mar 11 18:17:12 2013 +0100 @@ -332,6 +332,21 @@ -- WSTS +--lookup table for wst kinds +CREATE TABLE wst_kinds ( + id NUMBER PRIMARY KEY NOT NULL, + kind VARCHAR(64) NOT NULL +); +INSERT INTO wst_kinds (id, kind) VALUES (0, 'basedata'); +INSERT INTO wst_kinds (id, kind) VALUES (1, 'basedata_additionals_marks'); +INSERT INTO wst_kinds (id, kind) VALUES (2, 'basedata_fixations_wst'); +INSERT INTO wst_kinds (id, kind) VALUES (3, 'basedata_officials'); +INSERT INTO wst_kinds (id, kind) VALUES (4, 'basedata_heightmarks-points-relative_points'); +INSERT INTO wst_kinds (id, kind) VALUES (5, 'basedata_flood-protections_relative_points'); +INSERT INTO wst_kinds (id, kind) VALUES (6, 'morpho_waterlevel-differences'); +INSERT INTO wst_kinds (id, kind) VALUES (7, 'morpho_waterlevels'); + + CREATE SEQUENCE WSTS_ID_SEQ; CREATE TABLE wsts ( @@ -378,6 +393,7 @@ ALTER TABLE wst_column_values ADD CONSTRAINT cWstColumnValuesWstColumns FOREIGN KEY (wst_column_id) REFERENCES wst_columns ON DELETE CASCADE; ALTER TABLE wst_q_ranges ADD CONSTRAINT cWstQRangesRanges FOREIGN KEY (range_id) REFERENCES RANGES ON DELETE CASCADE; ALTER TABLE wsts ADD CONSTRAINT cWstsRivers FOREIGN KEY (river_id) REFERENCES rivers ON DELETE CASCADE; +ALTER TABLE wsts ADD CONSTRAINT cWstsWstKinds FOREIGN KEY (kind) REFERENCES wst_kinds; -- VIEWS