← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18970: Added index on programstageinstance > organisationunitid. Removed java code for adding indexes, u...

 

------------------------------------------------------------
revno: 18970
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-04-21 20:32:37 +0200
message:
  Added index on programstageinstance > organisationunitid. Removed java code for adding indexes, using hibernate mapping / hbm2ddl instead.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/MessageConversation.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml


--
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/TableCreator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2015-04-21 18:08:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2015-04-21 18:32:37 +0000
@@ -28,8 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,8 +39,6 @@
 public class TableCreator
     extends AbstractStartupRoutine
 {
-    private Log log = LogFactory.getLog( TableCreator.class );
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -61,28 +57,5 @@
     public void execute()
     {
         aggregatedDataValueService.createDataMart();
-        
-        createSilently( "CREATE INDEX messageconversation_lastmessage ON messageconversation (lastmessage)", "messageconversation_lastmessage" );
-        createSilently( "CREATE INDEX interpretation_lastupdated ON interpretation (lastupdated)", "interpretation_lastupdated" );
-        createSilently( "CREATE INDEX programstageinstance_executiondate ON programstageinstance (executiondate)", "programstageinstance_executiondate" );
-
-    }
-
-    // -------------------------------------------------------------------------
-    // Supportive methods
-    // -------------------------------------------------------------------------
-
-    private void createSilently( final String sql, final String name )
-    {
-        try
-        {
-            jdbcTemplate.execute( sql );
-            
-            log.info( "Created table/index " + name );
-        }
-        catch ( Exception ex )
-        {
-            log.debug( "Table/index " + name + " exists" );
-        }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/MessageConversation.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/MessageConversation.hbm.xml	2012-12-13 11:53:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/MessageConversation.hbm.xml	2015-04-21 18:32:37 +0000
@@ -36,7 +36,7 @@
     <many-to-one name="lastSender" class="org.hisp.dhis.user.User" column="lastsenderid"
       foreign-key="fk_messageconversation_userid" />
 
-    <property name="lastMessage" column="lastmessage" />
+    <property name="lastMessage" column="lastmessage" index="messageconversation_lastmessage" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml	2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml	2015-04-21 18:32:37 +0000
@@ -11,7 +11,8 @@
     </id>
 
     <property name="uid" column="uid" length="11" />
-    <property name="lastUpdated" type="timestamp" />
+    
+    <property name="lastUpdated" type="timestamp" index="interpretation_lastupdated" />
 
     <many-to-one name="chart" class="org.hisp.dhis.chart.Chart" column="chartid"
       foreign-key="fk_interpretation_chartid" />

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml	2015-04-21 18:08:09 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml	2015-04-21 18:32:37 +0000
@@ -28,7 +28,7 @@
 
     <many-to-one name="organisationUnit"
       class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
-      foreign-key="fk_programstageinstance_organisationunitid" />
+      foreign-key="fk_programstageinstance_organisationunitid" index="programstageinstance_organisationunitid" />
 
     <list name="outboundSms" table="programstageinstance_outboundsms">
       <key column="programstageinstanceid" />
@@ -60,8 +60,5 @@
       <many-to-many column="trackedentitycommentid" unique="true" class="org.hisp.dhis.trackedentitycomment.TrackedEntityComment" />
     </list>
 
-    <!--<many-to-one name="comment" cascade="all" class="org.hisp.dhis.trackedentitycomment.TrackedEntityComment"
-        column="trackedentitycommentid" foreign-key="fk_programinstance_commentid" />-->
-
   </class>
 </hibernate-mapping>