# HG changeset patch # User Sascha L. Teichmann # Date 1303146060 0 # Node ID 0addc2663a4d1f56ea4f18ae6c2634b1b5469e06 # Parent 77f3376502110cea1100d34f727aefb0eaa97c63 Forgot to add db update to changelog flys-backend/trunk@1725 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 77f337650211 -r 0addc2663a4d flys-backend/ChangeLog --- a/flys-backend/ChangeLog Mon Apr 18 15:52:53 2011 +0000 +++ b/flys-backend/ChangeLog Mon Apr 18 17:01:00 2011 +0000 @@ -4,6 +4,31 @@ Added a view 'wst_value_table' which aggregates the data to build w/q value tables. + To update existing databases: + + BEGIN; + CREATE VIEW wst_value_table AS + SELECT wcv.position AS position, + w, + (SELECT q + FROM wst_column_q_ranges wcqr + JOIN wst_q_ranges wqr + ON wcqr.wst_q_range_id = wqr.id + JOIN ranges r + ON r.id = wqr.range_id + WHERE wcqr.wst_column_id = wc.id + AND wcv.position BETWEEN r.a AND r.b) AS q, + wc.position AS column_pos, + w.id AS wst_id + FROM wst_column_values wcv + JOIN wst_columns wc + ON wcv.wst_column_id = wc.id + JOIN wsts w + ON wc.wst_id = w.id + ORDER BY wcv.position ASC, + wc.position DESC; + COMMIT; + 2011-04-18 Sascha L. Teichmann * src/main/java/de/intevation/flys/model/Wst.java: