annotate backend/doc/schema/oracle-sinfo-uinfo.sql @ 9031:efd2de78d158

work on unit testing
author gernotbelger
date Fri, 27 Apr 2018 11:34:04 +0200
parents ce99d3db9477
children 1f63e9d3b0ec
rev   line source
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
1 SET AUTOCOMMIT ON;
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
2
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
3
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
4 --Add new column wsts.sinfo_selection
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
5
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
6 ALTER TABLE wsts ADD COLUMN sinfo_selection CHAR(1) CHECK((sinfo_selection IS NULL) OR (sinfo_selection IN ('W','Q')));
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
7 COMMENT ON COLUMN wsts.sinfo_selection IS 'Whether and how the WST series is selected within S-INFO calculation types ("W"=without-Q-group, "Q"=with-Q-group, NULL=not-selectable)' ;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
8
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
9
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
10 --Add new columns bed_height.sounding_width_info and bed_height.comment
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
11
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
12 ALTER TABLE bed_height ADD COLUMN sounding_width_info VARCHAR2(256);
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
13 COMMENT ON COLUMN bed_height.sounding_width_info IS 'File header line info "ausgewertete Peilbreite"' ;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
14
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
15 ALTER TABLE bed_height ADD COLUMN "comment" VARCHAR2(256);
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
16 COMMENT ON COLUMN bed_height."comment" IS 'File header line info "weitere Bemerkungen"' ;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
17
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
18
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
19 --Add new columns bed_height_values.min_height (Talweg) and bed_height_values.max_height (Kammlage) (same type as existing height column)
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
20
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
21 ALTER TABLE bed_height_values ADD COLUMN min_height DOUBLE PRECISION;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
22 COMMENT ON COLUMN bed_height_values.min_height IS 'Minimum bed height (Talweg) in m' ;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
23
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
24 ALTER TABLE bed_height_values ADD COLUMN max_height DOUBLE PRECISION;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
25 COMMENT ON COLUMN bed_height_values.max_height IS 'Maximum bed height (Kammlage) in m' ;
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
26
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
27
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
28 --Bed mobility
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
29
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
30 CREATE TABLE bed_mobility (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
31 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
32 river_id NUMBER(38,0) NOT NULL CONSTRAINT cBedMobilityRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
33 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
34 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
35 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
36 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
37 COMMENT ON TABLE bed_mobility IS 'Longitudinal section of the bed mobility of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
38 COMMENT ON COLUMN bed_mobility.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
39 COMMENT ON COLUMN bed_mobility.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
40 COMMENT ON COLUMN bed_mobility."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
41
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
42 CREATE SEQUENCE BED_MOBILITY_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
43
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
44
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
45 CREATE TABLE bed_mobility_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
46 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
47 bed_mobility_id NUMBER(9,0) NOT NULL CONSTRAINT cBedMobilityValuesBedMobility REFERENCES bed_mobility(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
48 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
49 moving NUMBER(1,0) DEFAULT 0 NOT NULL CHECK(moving IN (0,1))
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
50 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
51 COMMENT ON TABLE bed_mobility_values IS 'Bed mobility of a km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
52 COMMENT ON COLUMN bed_mobility_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
53 COMMENT ON COLUMN bed_mobility_values.moving IS 'Whether the river bed at the station is moving' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
54
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
55 CREATE SEQUENCE BED_MOBILITY_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
56
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
57
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
58 --Infrastructure
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
59
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
60 CREATE TABLE infrastructure (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
61 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
62 river_id NUMBER(38,0) NOT NULL CONSTRAINT cInfrastructureRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
63 annotation_type_id NUMBER(38,0) NOT NULL CONSTRAINT cInfrastructureAnnotationType REFERENCES annotation_types(id),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
64 year NUMBER(4,0) CHECK((year >= 1700) AND (year <= 2199)),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
65 dataprovider VARCHAR2(256),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
66 evaluation_by VARCHAR2(256),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
67 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
68 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
69 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
70 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
71 COMMENT ON TABLE infrastructure IS 'Longitudinal section of infrastructures of a river and a type' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
72 COMMENT ON COLUMN infrastructure.year IS 'File header line info "Stand"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
73 COMMENT ON COLUMN infrastructure.dataprovider IS 'File header line info "Datenherkunft"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
74 COMMENT ON COLUMN infrastructure.evaluation_by IS 'File header line info "Auswerter"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
75 COMMENT ON COLUMN infrastructure.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
76 COMMENT ON COLUMN infrastructure.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
77 COMMENT ON COLUMN infrastructure."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
78
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
79 CREATE SEQUENCE INFRASTRUCTURE_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
80
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
81
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
82 CREATE TABLE infrastructure_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
83 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
84 infrastructure_id NUMBER(9,0) CONSTRAINT cInfrastructureValuesInfrastructure REFERENCES infrastructure(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
85 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
86 attribute_id NUMBER(38,0) CONSTRAINT cInfrastructureValuesAttributes REFERENCES attributes(id),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
87 height NUMBER(6,2)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
88 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
89 COMMENT ON TABLE infrastructure_values IS 'Infrastructure at a river station' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
90 COMMENT ON COLUMN infrastructure_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
91 COMMENT ON COLUMN infrastructure_values.height IS 'Geodetic height of the top of the infrastructure in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
92
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
93 CREATE SEQUENCE INFRASTRUCTURE_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
94
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
95
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
96 --Channel
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
97
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
98 CREATE TABLE channel (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
99 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
100 river_id NUMBER(38,0) NOT NULL CONSTRAINT cChannelRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
101 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
102 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
103 "comment" VARCHAR2(256),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
104 year_from NUMBER(4,0),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
105 year_to NUMBER(4,0)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
106 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
107 COMMENT ON TABLE channel IS 'Longitudinal section of the navigable channel of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
108 COMMENT ON COLUMN channel.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
109 COMMENT ON COLUMN channel.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
110 COMMENT ON COLUMN channel."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
111 COMMENT ON COLUMN channel.year_from IS 'Start year of the period for which the channel values are valid, NULL when valid for the whole past';
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
112 COMMENT ON COLUMN channel.year_to IS 'End year of the period for which the channel values are valid, NULL when unlimited';
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
113
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
114
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
115 CREATE SEQUENCE CHANNEL_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
116
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
117
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
118 CREATE TABLE channel_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
119 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
120 channel_id NUMBER(9,0) CONSTRAINT cChannelValuesChannel REFERENCES channel(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
121 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
122 width NUMBER(6,2),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
123 depth NUMBER(6,2)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
124 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
125 COMMENT ON TABLE channel_values IS 'Nominal size of the navigable channel at a river station' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
126 COMMENT ON COLUMN channel_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
127 COMMENT ON COLUMN channel_values.width IS 'Nominal width of the channel in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
128 COMMENT ON COLUMN channel_values.depth IS 'Nominal depth of the channel in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
129
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
130 CREATE SEQUENCE CHANNEL_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
131
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
132
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
133 --Collision
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
134
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
135 CREATE TABLE collision_type (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
136 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
137 name VARCHAR2(64) NOT NULL UNIQUE
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
138 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
139 COMMENT ON TABLE collision_type IS 'Type of a ship collision' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
140 COMMENT ON COLUMN collision_type.name IS 'Name of the collision type' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
141
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
142 CREATE SEQUENCE COLLISION_TYPE_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
143
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
144
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
145 CREATE TABLE collision (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
146 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
147 river_id NUMBER(38,0) NOT NULL CONSTRAINT cCollisionRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
148 year NUMBER(4,0) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
149 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
150 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
151 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
152 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
153 COMMENT ON TABLE collision IS 'Longitudinal section of ship collisions with the river bed' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
154 COMMENT ON COLUMN collision.year IS 'File header line info "Jahr"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
155 COMMENT ON COLUMN collision.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
156 COMMENT ON COLUMN collision.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
157 COMMENT ON COLUMN collision."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
158
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
159 CREATE SEQUENCE COLLISION_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
160
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
161
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
162 CREATE TABLE collision_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
163 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
164 collision_id NUMBER(9,0) NOT NULL CONSTRAINT cCollisionValueCollision REFERENCES collision(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
165 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
166 event_date DATE NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
167 gauge_w NUMBER(6,2),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
168 gauge_name VARCHAR2(64),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
169 collision_type_id NUMBER(9,0) NOT NULL CONSTRAINT cCollisionValuesCollisionType REFERENCES collision_type(id)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
170 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
171 COMMENT ON TABLE collision_values IS 'Collision event' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
172 COMMENT ON COLUMN collision_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
173 COMMENT ON COLUMN collision_values.event_date IS 'Date of the collision' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
174 COMMENT ON COLUMN collision_values.gauge_w IS 'Waterlevel during the collision' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
175 COMMENT ON COLUMN collision_values.gauge_name IS 'Name of the gauge' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
176
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
177 CREATE SEQUENCE COLLISION_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
178
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
179
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
180 --Tkh
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
181
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
182 CREATE TABLE tkh (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
183 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
184 river_id NUMBER(38,0) NOT NULL CONSTRAINT cTkhRivers REFERENCES rivers(id) ON DELETE CASCADE,
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
185 day DATE,
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
186 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
187 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
188 sounding_info VARCHAR2(64),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
189 evaluation_by VARCHAR2(256),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
190 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
191 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
192 COMMENT ON TABLE tkh IS 'Longitudinal section of computed Transportk�rperh�he of a river' ;
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
193 COMMENT ON COLUMN tkh.day IS 'File header line info "Datum"' ;
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
194 COMMENT ON COLUMN tkh.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
195 COMMENT ON COLUMN tkh.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
196 COMMENT ON COLUMN tkh.sounding_info IS 'File header line info "Peilung"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
197 COMMENT ON COLUMN tkh.evaluation_by IS 'File header line info "Auswerter"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
198 COMMENT ON COLUMN tkh."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
199
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
200 CREATE SEQUENCE TKH_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
201
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
202
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
203 CREATE TABLE tkh_column (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
204 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
205 tkh_id NUMBER(9,0) NOT NULL CONSTRAINT cTkhColumnTkh REFERENCES tkh(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
206 name VARCHAR2(64) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
207 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
208 COMMENT ON TABLE tkh_column IS 'Longitudinal section of computed Transportk�rperh�he for a waterlevel series' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
209 COMMENT ON COLUMN tkh_column.name IS 'Name of the tkh computation column' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
210
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
211 CREATE SEQUENCE TKH_COLUMN_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
212
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
213
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
214 CREATE TABLE tkh_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
215 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
216 tkh_column_id NUMBER(9,0) NOT NULL CONSTRAINT cTkhValuesTkhColumn REFERENCES tkh_column(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
217 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
218 tkheight NUMBER(7,3)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
219 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
220 COMMENT ON TABLE tkh_values IS 'Transportk�rperh�he of a river station and referenced file column' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
221 COMMENT ON COLUMN tkh_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
222 COMMENT ON COLUMN tkh_values.tkheight IS 'Transportk�rperh�he of a river station computed for a waterlevel in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
223
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
224 CREATE SEQUENCE TKH_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
225
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
226
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
227 --Flow depth
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
228
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
229 CREATE TABLE flow_depth (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
230 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
231 river_id NUMBER(38,0) NOT NULL CONSTRAINT cFlowDepthRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
232 year NUMBER(4,0) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
233 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
234 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
235 sounding_info VARCHAR2(64),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
236 evaluation_by VARCHAR2(255),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
237 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
238 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
239
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
240 COMMENT ON TABLE flow_depth IS 'Longitudinal section of computed flow depth of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
241 COMMENT ON COLUMN flow_depth.year IS 'File header line info "Bezugsjahr"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
242 COMMENT ON COLUMN flow_depth.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
243 COMMENT ON COLUMN flow_depth.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
244 COMMENT ON COLUMN flow_depth.sounding_info IS 'File header line info "Peilung"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
245 COMMENT ON COLUMN flow_depth.evaluation_by IS 'File header line info "Auswerter"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
246 COMMENT ON COLUMN flow_depth."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
247
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
248 CREATE SEQUENCE FLOW_DEPTH_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
249
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
250
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
251 CREATE TABLE flow_depth_column (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
252 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
253 flow_depth_id NUMBER(9,0) NOT NULL CONSTRAINT cFlowDepthColumnFlowDepth REFERENCES flow_depth(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
254 name VARCHAR2(64) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
255 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
256
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
257 COMMENT ON TABLE flow_depth_column IS 'Longitudinal section of computed flow depth for a waterlevel series' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
258 COMMENT ON COLUMN flow_depth_column.name IS 'Name of the flow depth computation column' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
259
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
260 CREATE SEQUENCE FLOW_DEPTH_COLUMN_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
261
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
262
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
263 CREATE TABLE flow_depth_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
264 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
265 flow_depth_column_id NUMBER(9,0) NOT NULL CONSTRAINT cFlowDepthValuesFlowDepthColumn REFERENCES flow_depth_column(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
266 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
267 depth NUMBER(7,3)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
268 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
269
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
270 COMMENT ON TABLE flow_depth_values IS 'Flow depth of a river station and referenced file column' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
271 COMMENT ON COLUMN flow_depth_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
272 COMMENT ON COLUMN flow_depth_values.depth IS 'Flow depth of a river station computed for a waterlevel in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
273
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
274 CREATE SEQUENCE FLOW_DEPTH_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
275
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
276
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
277 --Depth evolution
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
278
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
279 CREATE TABLE depth_evolution (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
280 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
281 river_id NUMBER(38,0) NOT NULL CONSTRAINT cDepthEvolutionRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
282 reference_year NUMBER(4,0) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
283 start_year NUMBER(4,0) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
284 curr_sounding VARCHAR2(64) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
285 old_sounding VARCHAR2(64) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
286 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
287 curr_glw VARCHAR2(64) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
288 old_glw VARCHAR2(64) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
289 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
290 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
291 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
292 COMMENT ON TABLE depth_evolution IS 'Longitudinal section of the evolution of the flow depth of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
293 COMMENT ON COLUMN depth_evolution.reference_year IS 'File header line info "Bezugsjahr" (GlW)' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
294 COMMENT ON COLUMN depth_evolution.start_year IS 'File header line info "Ausgangsjahr" (GlW)' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
295 COMMENT ON COLUMN depth_evolution.curr_sounding IS 'File header line info "Aktuelle Peilung / Epoche"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
296 COMMENT ON COLUMN depth_evolution.old_sounding IS 'File header line info "Historische Peilung / Epoche"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
297 COMMENT ON COLUMN depth_evolution.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
298 COMMENT ON COLUMN depth_evolution.curr_glw IS 'File header line info "Aktuelle Wasserspiegellage"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
299 COMMENT ON COLUMN depth_evolution.old_glw IS 'File header line info "Historische Wasserspiegellage"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
300 COMMENT ON COLUMN depth_evolution.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
301 COMMENT ON COLUMN depth_evolution."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
302
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
303 CREATE SEQUENCE DEPTH_EVOLUTION_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
304
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
305
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
306 CREATE TABLE depth_evolution_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
307 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
308 depth_evolution_id NUMBER(9,0) NOT NULL CONSTRAINT cDepthEvolutionValuesDepthEvolution REFERENCES depth_evolution(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
309 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
310 total_change NUMBER(8,4),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
311 change_per_year NUMBER(8,4)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
312 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
313 COMMENT ON TABLE depth_evolution_values IS 'Evolution of the flow depth of a river station in a referenced period of time' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
314 COMMENT ON COLUMN depth_evolution_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
315 COMMENT ON COLUMN depth_evolution_values.total_change IS 'Flow depth change of the whole period of time in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
316 COMMENT ON COLUMN depth_evolution_values.change_per_year IS 'Average yearly flow depth change in the referenced period of time in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
317
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
318 CREATE SEQUENCE DEPTH_EVOLUTION_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
319
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
320
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
321 --Daily discharge
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
322
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
323 CREATE TABLE daily_discharge (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
324 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
325 gauge_id NUMBER(38,0) NOT NULL CONSTRAINT cDailyDischargeGauge REFERENCES gauges(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
326 filename VARCHAR2(256) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
327 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
328
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
329 COMMENT ON TABLE daily_discharge IS 'Daily discharge value series' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
330 COMMENT ON COLUMN daily_discharge.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
331
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
332 CREATE SEQUENCE DAILY_DISCHARGE_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
333
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
334
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
335 CREATE TABLE daily_discharge_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
336 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
337 daily_discharge_id NUMBER(9,0) NOT NULL CONSTRAINT cDailyDischargeValueDailyDischarge REFERENCES daily_discharge(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
338 day DATE NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
339 discharge NUMBER(8,3) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
340 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
341
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
342 COMMENT ON TABLE daily_discharge_values IS 'Mean daily discharge of a date and a gauge' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
343 COMMENT ON COLUMN daily_discharge_values.day IS 'Date of the discharge value' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
344 COMMENT ON COLUMN daily_discharge_values.discharge IS 'Mean daily discharge in m^3/s' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
345
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
346 CREATE SEQUENCE DAILY_DISCHARGE_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
347
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
348
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
349 --Salix line
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
350
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
351 CREATE TABLE salix (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
352 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
353 river_id NUMBER(38,0) NOT NULL CONSTRAINT cSalixRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
354 evaluation_by VARCHAR2(255),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
355 kmrange_info VARCHAR2(32),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
356 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
357 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
358 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
359
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
360 COMMENT ON TABLE salix IS 'Longitudinal section of the salix line parameters of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
361 COMMENT ON COLUMN salix.evaluation_by IS 'File header line info "Auswerter"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
362 COMMENT ON COLUMN salix.kmrange_info IS 'File header line info "Strecke"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
363 COMMENT ON COLUMN salix.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
364 COMMENT ON COLUMN salix."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
365
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
366 CREATE SEQUENCE SALIX_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
367
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
368
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
369 CREATE TABLE salix_values (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
370 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
371 salix_id NUMBER(9,0) NOT NULL CONSTRAINT cSalixValuesSalix REFERENCES salix(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
372 station NUMBER(7,3) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
373 factor NUMBER(6,2) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
374 mnw_mw_diff NUMBER(6,2)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
375 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
376
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
377 COMMENT ON COLUMN salix_values.station IS 'River km' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
378 COMMENT ON COLUMN salix_values.factor IS 'Salix "factor" of the station in m' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
379 COMMENT ON COLUMN salix_values.mnw_mw_diff IS 'Difference between MNW and MW in m (less than zero)' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
380
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
381 CREATE SEQUENCE SALIX_VALUES_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
382
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
383
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
384 CREATE TABLE salix_rank (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
385 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
386 min_value NUMBER(6,2),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
387 max_value NUMBER(6,2),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
388 name VARCHAR2(16) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
389 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
390 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (1, NULL, -0.3, 'invalid');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
391 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (2, -0.3, 0.3, 'very good');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
392 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (3, 0.3, 0.5, 'good');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
393 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (4, 0.5, 1.0, 'moderate');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
394 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (5, 1.0, 1.5, 'bad');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
395 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (6, 1.5, NULL, 'very bad');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
396
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
397
9008
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
398 --Vegetation zone
ce99d3db9477 Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents: 8990
diff changeset
399
8990
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
400 CREATE TABLE vegetation_type (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
401 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
402 name VARCHAR2(256) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
403 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
404 INSERT INTO vegetation_type (id, name) VALUES (1, 'zonal forest');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
405 INSERT INTO vegetation_type (id, name) VALUES (2, 'dry hartwood forest floodplain');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
406 INSERT INTO vegetation_type (id, name) VALUES (3, 'wet hartwood forest floodplain');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
407 INSERT INTO vegetation_type (id, name) VALUES (4, 'salix alba forest');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
408 INSERT INTO vegetation_type (id, name) VALUES (5, 'salix shrubs');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
409 INSERT INTO vegetation_type (id, name) VALUES (6, 'reed bed');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
410 INSERT INTO vegetation_type (id, name) VALUES (7, 'bank pioneers');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
411 INSERT INTO vegetation_type (id, name) VALUES (8, 'no vegetation');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
412 INSERT INTO vegetation_type (id, name) VALUES (9, 'water');
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
413
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
414
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
415 CREATE TABLE vegetation (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
416 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
417 river_id NUMBER(38,0) NOT NULL CONSTRAINT cVegetationRivers REFERENCES rivers(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
418 name VARCHAR2(256),
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
419 filename VARCHAR2(256) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
420 "comment" VARCHAR2(256)
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
421 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
422
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
423 COMMENT ON TABLE vegetation IS 'Classification of the vegetation of a river' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
424 COMMENT ON COLUMN vegetation.name IS 'File header line info "Einteilung"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
425 COMMENT ON COLUMN vegetation.filename IS 'Name without type extension of the imported file' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
426 COMMENT ON COLUMN vegetation."comment" IS 'File header line info "weitere Bemerkungen"' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
427
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
428 CREATE SEQUENCE VEGETATION_ID_SEQ ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
429
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
430
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
431 CREATE TABLE vegetation_zone (
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
432 id NUMBER(9,0) PRIMARY KEY,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
433 vegetation_id NUMBER(9,0) NOT NULL CONSTRAINT cVegetationZoneVegetation REFERENCES vegetation(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
434 vegetation_type_id NUMBER(9,0) NOT NULL CONSTRAINT cVegetationZoneVegetationType REFERENCES vegetation_type(id) ON DELETE CASCADE,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
435 min_overflow_days NUMBER(3,0) NOT NULL,
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
436 max_overflow_days NUMBER(3,0) NOT NULL
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
437 );
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
438
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
439 COMMENT ON TABLE vegetation_zone IS 'Vegetation zone of a river station' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
440 COMMENT ON COLUMN vegetation_zone.min_overflow_days IS 'Minimum number (inclusive) of overflow days in a year for the zone type' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
441 COMMENT ON COLUMN vegetation_zone.max_overflow_days IS 'Maximum number (exclusive) of overflow days in a year for the zone type' ;
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
442
07dcedddf839 Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
diff changeset
443 CREATE SEQUENCE VEGETATION_ZONE_ID_SEQ ;

http://dive4elements.wald.intevation.org