← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13958: Modify the sql file to convert database in tracker module.

 

------------------------------------------------------------
revno: 13958
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-02-09 09:56:41 +0700
message:
  Modify the sql file to convert database in tracker module.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
  resources/sql/rename-patient-to-trackedentity-in-database.sql


--
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-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-02-09 02:56:41 +0000
@@ -228,13 +228,13 @@
 
         executeSql( "update systemsetting set \"name\"='trackedEntityExcelTemplateFileName' where \"name\"='patientExcelTemplateFileName'" );
         executeSql( "update systemsetting set \"name\"='autoSavetTrackedEntityForm' where \"name\"='autoSavePatientRegistration'" );
-        
 
         executeSql( "UPDATE trackedentityattribute SET uniquefield=false WHERE uniquefield is null" );
 
         executeSql( "INSERT INTO trackedentityattribute "
             + "( trackedentityattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule, uniquefield, orgunitScope, programScope )"
-            + " select " + statementBuilder.getAutoIncrementValue()
+            + " select "
+            + statementBuilder.getAutoIncrementValue()
             + ", uid, lastUpdated, name,  description, type, mandatory, false, false, true, orgunitScope, programScope from patientidentifiertype" );
 
         executeSql( "INSERT INTO trackedentityattributevalue (trackedentityinstanceid, trackedentityattributeid, value ) "
@@ -245,6 +245,7 @@
         executeSql( "DROP TABLE program_identifiertypes" );
         executeSql( "DROP TABLE patientidentifier" );
         executeSql( "DROP TABLE patientidentifiertype" );
+        executeSql( "ALTER TABLE trackedentityattribute RENAME CONSTRAINT fk_patientidentifiertype_periodtypeid TO trackedentityattribute_periodtypeid" );
     }
 
     // -------------------------------------------------------------------------
@@ -428,7 +429,6 @@
         }
     }
 
-
     private int executeSql( String sql )
     {
         try

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-02-09 02:56:41 +0000
@@ -63,7 +63,7 @@
 everything_is_ok=Everything is OK
 tracked_entity_attribute=Attribute
 program=Program
-tracked_entity_aggregation_query_builder=Aggregation Query Builder
+aggregation_query_builder=Aggregation Query Builder
 tracked_entity_aggregation_query_builder_management=Aggregation query builder management
 dataelements=Data elements
 tracked_entity_attributes=Attributes
@@ -311,7 +311,7 @@
 block_entry_form_after_completed = Block entry form after completed
 select_operator_number_of_visits_for_this_condition = Please select operator number of visit for this condition
 add_tracked_entity_registration_form = Add tracked entity form
-intro_tracked_entity_registration_form = Create custom tracked entity forms with tracked entity attributes.
+intro_tracked_entity_form = Create custom tracked entity forms with tracked entity attributes.
 tracked_entity_registration_form_management = Tracked entity form management
 properties = Properties
 full_name = Full name
@@ -391,7 +391,7 @@
 view_all = View all
 tracked_entity_attribute_visit_schedule = Attribute Visit Schedule
 tracked_entity_attribute_visit_schedule_form = Tracked entity attribute visit schedule
-intro_tracked_entity_attribute_visit_schedule = Configure which tracked entity attributes are added to the visit schedule. Gives better overview when used for tracking.
+intro_attribute_visit_schedule = Configure which tracked entity attributes are added to the visit schedule. Gives better overview when used for tracking.
 selected_program_stages = Selected program stages
 tracked_entity = Tracked entity
 orgunit_registered = Organisation unit phone number

=== modified file 'resources/sql/rename-patient-to-trackedentity-in-database.sql'
--- resources/sql/rename-patient-to-trackedentity-in-database.sql	2014-02-07 20:25:49 +0000
+++ resources/sql/rename-patient-to-trackedentity-in-database.sql	2014-02-09 02:56:41 +0000
@@ -12,13 +12,12 @@
 ALTER TABLE trackedentityattribute RENAME COLUMN patientattributeid TO trackedentityattributeid;
 ALTER TABLE trackedentityattribute RENAME COLUMN patientattributegroupid TO trackedentityattributegroupid;
 ALTER TABLE trackedentityattribute RENAME CONSTRAINT patientattribute_pkey TO trackedentityattribute_pkey;
-ALTER TABLE trackedentityattribute RENAME CONSTRAINT fk_patientidentifiertype_periodtypeid TO trackedentityattribute_periodtypeid;
 ALTER TABLE trackedentityattribute RENAME CONSTRAINT patientattribute_code_key TO trackedentityattribute_code_key;
 ALTER TABLE trackedentityattribute RENAME CONSTRAINT patientattribute_name_key TO trackedentityattribute_name_key;
 
 
 Alter table patientattributegroup rename to trackedentityattributegroup;
-ALTER TABLE trackedentityattributegroup RENAME COLUMN patientattributeoptionid TO trackedentityattributegroupid;
+ALTER TABLE trackedentityattributegroup RENAME COLUMN patientattributegroupid TO trackedentityattributegroupid;
 ALTER TABLE trackedentityattributegroup RENAME CONSTRAINT patientattributegroup_pkey TO trackedentityattributegroup_pkey;
 ALTER TABLE trackedentityattributegroup RENAME CONSTRAINT patientattributegroup_code_key TO trackedentityattributegroup_code_key;
 ALTER TABLE trackedentityattributegroup RENAME CONSTRAINT patientattributegroup_name_key TO trackedentityattributegroup_name_key;
@@ -98,7 +97,7 @@
 ALTER TABLE trackedentityaggregatereportusergroupaccesses RENAME CONSTRAINT patientaggregatereportusergroupaccesses_pkey TO trackedentityaggregatereportusergroupaccesses_pkey;
 
 
-ALTER TABLE patienttabularreport RENAME TO trackedentitytabularreport
+ALTER TABLE patienttabularreport RENAME TO trackedentitytabularreport;
 ALTER TABLE trackedentitytabularreport RENAME COLUMN patienttabularreportid TO trackedentitytabularreportid;
 ALTER TABLE trackedentitytabularreport RENAME CONSTRAINT patienttabularreport_pkey TO trackedentitytabularreport_pkey;
 ALTER TABLE trackedentitytabularreport RENAME CONSTRAINT fk_patientaggregatereport_programstage TO fk_tabularreport_programstage;
@@ -151,6 +150,19 @@
 ALTER TABLE programinstance RENAME COLUMN patientcommentid TO trackedentitycommentid;
 ALTER TABLE programinstance RENAME COLUMN patientid TO trackedentityinstanceid;
 
+
 ALTER TABLE programstage_dataelements RENAME COLUMN patienttabularreportid TO trackedentitytabularreportid;
 
 
+ALTER TABLE programstageinstance RENAME COLUMN patientcommentid TO trackedentitycommentid;
+ALTER TABLE trackedentityattribute RENAME COLUMN patientmobilesettingid TO trackedentitymobilesettingid;
+ALTER TABLE trackedentityattribute RENAME COLUMN sort_order_patientattributename TO sort_order_trackedentityattributename;
+
+
+ALTER TABLE patientaggregatereportmembers RENAME COLUMN patientaggregatereportid TO trackedentityaggregatereportid;
+ALTER TABLE trackedentityaudit RENAME COLUMN patientid TO trackedentityinstanceid;
+ALTER TABLE patienttabularreportmembers RENAME COLUMN patienttabularreportid TO trackedentitytabularreportid;
+ALTER TABLE programstageinstance_patients RENAME COLUMN patientid TO trackedentityinstanceid;
+ALTER TABLE programinstance RENAME COLUMN patientid TO trackedentityinstanceid;
+ALTER TABLE programinstance RENAME COLUMN patientcommentid TO trackedentitycommentid;
+