← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21836: fix for datavalueaudit timetamp => created rename

 

------------------------------------------------------------
revno: 21836
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2016-01-30 17:21:56 +0700
message:
  fix for datavalueaudit timetamp => created rename
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.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	2016-01-18 03:51:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2016-01-30 10:21:56 +0000
@@ -120,9 +120,11 @@
 
     private void updateTimestamps()
     {
-        executeSql( "alter table datavalueaudit rename column timestamp to created" );
+        executeSql( "update datavalueaudit set created=timestamp where created is null" );
+        executeSql( "update datavalueaudit set created=now() where created is null" );
+        executeSql( "alter table datavalueaudit drop column timestamp" );
+
         executeSql( "alter table trackedentitydatavalueaudit rename column timestamp to created" );
-
         executeSql( "update trackedentitydatavalue set created=timestamp where created is null" );
         executeSql( "update trackedentitydatavalue set lastupdated=timestamp where lastupdated is null" );
         executeSql( "alter table trackedentitydatavalue drop column timestamp" );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java	2016-01-26 04:34:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java	2016-01-30 10:21:56 +0000
@@ -79,7 +79,6 @@
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.http.HttpHeaders;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;