diff flys-backend/ChangeLog @ 477:0addc2663a4d

Forgot to add db update to changelog flys-backend/trunk@1725 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Apr 2011 17:01:00 +0000
parents 77f337650211
children db430bd9e0e0
line wrap: on
line diff
--- 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	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/Wst.java:

http://dive4elements.wald.intevation.org