← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20680: updated init table alteror with sensible defaults for null columns (for enums)

 

------------------------------------------------------------
revno: 20680
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-14 09:31:19 +0700
message:
  updated init table alteror with sensible defaults for null columns (for enums)
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.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/InitTableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2015-09-29 15:14:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2015-10-14 02:31:19 +0000
@@ -92,6 +92,8 @@
         executeSql( "update programinstance set status='ACTIVE' where status='0'" );
         executeSql( "update programinstance set status='COMPLETED' where status='1'" );
         executeSql( "update programinstance set status='CANCELLED' where status='2'" );
+
+        executeSql( "update programinstance set status='ACTIVE' where status is null" );
     }
 
     private void updateValidationRuleEnums()
@@ -135,6 +137,8 @@
         executeSql( "update dataelement set aggregationtype='NONE' where aggregationtype='none'" );
         executeSql( "update dataelement set aggregationtype='DEFAULT' where aggregationtype='default'" );
         executeSql( "update dataelement set aggregationtype='CUSTOM' where aggregationtype='custom'" );
+
+        executeSql( "update dataelement set aggregationtype='SUM' where aggregationtype is null" );
     }
 
     private void updateValueTypes()
@@ -166,6 +170,8 @@
         executeSql( "update dataelement set valuetype='TRUE_ONLY' where valuetype='trueOnly'" );
         executeSql( "update dataelement set valuetype='USERNAME' where valuetype='username'" );
 
+        executeSql( "update dataelement set valuetype='NUMBER' where valuetype is null" );
+
         executeSql( "update trackedentityattribute set valuetype='TEXT' where valuetype='string'" );
         executeSql( "update trackedentityattribute set valuetype='PHONE_NUMBER' where valuetype='phoneNumber'" );
         executeSql( "update trackedentityattribute set valuetype='EMAIL' where valuetype='email'" );
@@ -178,6 +184,7 @@
         executeSql( "update trackedentityattribute set valuetype='OPTION_SET' where valuetype='optionSet'" );
         executeSql( "update trackedentityattribute set valuetype='TRACKER_ASSOCIATE' where valuetype='trackerAssociate'" );
         executeSql( "update trackedentityattribute set valuetype='USERNAME' where valuetype='users'" );
+        executeSql( "update trackedentityattribute set valuetype='TEXT' where valuetype is null" );
     }
 
     private void upgradeProgramStageDataElements()