← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16847: PT ER col/rowtotals startup issue fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16847 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-29 12:22:38 +0200
message:
  PT ER col/rowtotals startup issue fixed.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-09-22 10:08:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-09-29 10:21:23 +0000
@@ -162,12 +162,6 @@
         executeSql( "DELETE FROM period WHERE periodtypeid=(select periodtypeid from periodtype where name in ( 'Survey', 'OnChange', 'Relative' ))" );
         executeSql( "DELETE FROM periodtype WHERE name in ( 'Survey', 'OnChange', 'Relative' )" );
 
-        // upgrade reporttable and eventreport totals
-        executeSql( "UPDATE reporttable SET rowtotals = totals, coltotals = totals" );
-        executeSql( "ALTER TABLE reporttable DROP COLUMN totals" );
-        executeSql( "UPDATE eventreport SET rowtotals = totals, coltotals = totals" );
-        executeSql( "ALTER TABLE eventreport DROP COLUMN totals" );
-
         // mapping
         executeSql( "DROP TABLE maporganisationunitrelation" );
         executeSql( "ALTER TABLE mapview DROP COLUMN mapid" );
@@ -463,7 +457,6 @@
         executeSql( "update reporttable set userorganisationunit = false where userorganisationunit is null" );
         executeSql( "update reporttable set userorganisationunitchildren = false where userorganisationunitchildren is null" );
         executeSql( "update reporttable set userorganisationunitgrandchildren = false where userorganisationunitgrandchildren is null" );
-        executeSql( "update reporttable set totals = true where totals is null" );
         executeSql( "update reporttable set subtotals = true where subtotals is null" );
         executeSql( "update reporttable set hideemptyrows = false where hideemptyrows is null" );
         executeSql( "update reporttable set displaydensity = 'normal' where displaydensity is null" );
@@ -474,6 +467,14 @@
         executeSql( "update reporttable set showhierarchy = false where showhierarchy is null" );
         executeSql( "update reporttable set aggregationtype = 'default' where aggregationtype is null" );
 
+        // reporttable col/rowtotals = keep existing || copy from totals || true
+        executeSql( "update reporttable set totals = true where totals is null" );
+        executeSql( "update reporttable set coltotals = totals where coltotals is null" );
+        executeSql( "update reporttable set coltotals = true where coltotals is null" );
+        executeSql( "update reporttable set rowtotals = totals where rowtotals is null" );
+        executeSql( "update reporttable set rowtotals = true where rowtotals is null" );        
+        executeSql( "alter table reporttable drop column totals" );
+
         executeSql( "update chart set reportingmonth = false where reportingmonth is null" );
         executeSql( "update chart set reportingbimonth = false where reportingbimonth is null" );
         executeSql( "update chart set reportingquarter = false where reportingquarter is null" );
@@ -496,10 +497,18 @@
         executeSql( "update chart set userorganisationunitchildren = false where userorganisationunitchildren is null" );
         executeSql( "update chart set userorganisationunitgrandchildren = false where userorganisationunitgrandchildren is null" );
         executeSql( "update chart set hidetitle = false where hidetitle is null" );
-
+        
         executeSql( "update eventreport set showhierarchy = false where showhierarchy is null" );
         executeSql( "update eventreport set counttype = 'events' where counttype is null" );
 
+        // eventreport col/rowtotals = keep existing || copy from totals || true
+        executeSql( "update eventreport set totals = true where totals is null" );
+        executeSql( "update eventreport set coltotals = totals where coltotals is null" );
+        executeSql( "update eventreport set coltotals = true where coltotals is null" );
+        executeSql( "update eventreport set rowtotals = totals where rowtotals is null" );
+        executeSql( "update eventreport set rowtotals = true where rowtotals is null" );        
+        executeSql( "alter table eventreport drop column totals" );
+
         // Move chart filters to chart_filters table
 
         executeSql( "insert into chart_filters (chartid, sort_order, filter) select chartid, 0, filter from chart" );