Mercurial > gemma
diff schema/gemma.sql @ 1963:f7a35ba9f409
Added view for publishing bottlenecks
The new view adds reference gauge and reference water level to the
bottleneck information.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 22 Jan 2019 18:22:57 +0100 |
parents | f538d9a23329 |
children | d966f03ea819 |
line wrap: on
line diff
--- a/schema/gemma.sql Tue Jan 22 17:35:45 2019 +0100 +++ b/schema/gemma.sql Tue Jan 22 18:22:57 2019 +0100 @@ -471,6 +471,27 @@ PRIMARY KEY (bottleneck_id, riverbed) ) + -- Published view for GeoServer + CREATE VIEW bottlenecks_geoserver AS SELECT + b.bottleneck_id, + b.objnam, + b.nobjnm, + b.stretch, + b.area, + b.rb, + b.lb, + b.responsible_country, + b.revisiting_time, + b.limiting, + b.date_info, + b.source_organization, + g.location AS gauge_isrs_code, + g.objname AS gauge_objname, + grwl.reference_water_level, + grwl.value AS reference_water_level_value + FROM bottlenecks b, gauges g, gauges_reference_water_levels grwl + WHERE b.fk_g_fid = g.location AND g.location = grwl.gauge_id + CREATE TABLE sounding_results ( id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, bottleneck_id int NOT NULL REFERENCES bottlenecks(id),