dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36594
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18723: Table alteror fix
------------------------------------------------------------
revno: 18723
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-03-28 00:28:52 +0100
message:
Table alteror fix
modified:
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/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-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-03-27 15:45:41 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-03-27 23:28:52 +0000
@@ -324,24 +324,26 @@
// -------------------------------------------------------------------------
private void upgradeProgramStageDataElements()
- {
- String autoIncr = statementBuilder.getAutoIncrementValue();
-
- String insertSql =
- "insert into programstagedataelement(programstagedataelementid,programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,allowfuturedate) " +
- "select " + autoIncr + ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,allowfuturedate " +
- "from programstage_dataelements";
-
- int r = executeSql( insertSql );
+ {
+ int r = executeSql( "select 1 from programstage_dataelements" );
if ( r != -1 )
{
+ String autoIncr = statementBuilder.getAutoIncrementValue();
+
+ String insertSql =
+ "insert into programstagedataelement(programstagedataelementid,programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,allowfuturedate) " +
+ "select " + autoIncr + ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,allowfuturedate " +
+ "from programstage_dataelements";
+
+ executeSql( insertSql );
+
String dropSql = "drop table programstage_dataelements";
executeSql( dropSql );
log.info( "Upgraded program stage data elements" );
- }
+ }
}
private void updateAggregateQueryBuilder()