← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17327: Added id colums to _dataelementcategoryoptioncombo resource table

 

------------------------------------------------------------
revno: 17327
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-10-31 14:54:28 -0400
message:
  Added id colums to _dataelementcategoryoptioncombo resource table
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.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-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2014-10-23 09:29:17 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2014-10-31 18:54:28 +0000
@@ -523,16 +523,21 @@
             // Do nothing, table does not exist
         }
         
-        final String create = "CREATE TABLE " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + 
-            " (dataelementuid VARCHAR(11) NOT NULL, categoryoptioncombouid VARCHAR(11) NOT NULL)";
+        final String create = "CREATE TABLE " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " (" +
+            "dataelementid INTEGER NOT NULL, " +
+            "dataelementuid VARCHAR(11) NOT NULL, " +
+            "categoryoptioncomboid INTEGER NOT NULL, " +
+            "categoryoptioncombouid VARCHAR(11) NOT NULL)";
         
         jdbcTemplate.execute( create );
         
         log.info( "Create data element category option combo SQL: " + create );
         
         final String sql = 
-            "insert into " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " (dataelementuid, categoryoptioncombouid) " +
-            "select de.uid as dataelementuid, coc.uid as categoryoptioncombouid " +
+            "insert into " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + 
+            " (dataelementid, dataelementuid, categoryoptioncomboid, categoryoptioncombouid) " +
+            "select de.dataelementid as dataelementid, de.uid as dataelementuid, " +
+            "coc.categoryoptioncomboid as categoryoptioncomboid, coc.uid as categoryoptioncombouid " +
             "from dataelement de " +
             "join categorycombos_optioncombos cc on de.categorycomboid = cc.categorycomboid " +
             "join categoryoptioncombo coc on cc.categoryoptioncomboid = coc.categoryoptioncomboid";