← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13734: Had to remove not-null constraint on patientattribute.mandatory, caused problems when upgrading db

 

------------------------------------------------------------
revno: 13734
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-15 11:26:26 +0100
message:
  Had to remove not-null constraint on patientattribute.mandatory, caused problems when upgrading db
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.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-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2014-01-14 13:28:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2014-01-15 10:26:26 +0000
@@ -296,6 +296,9 @@
 
         executeSql( "UPDATE patientattribute SET displayinlistnoprogram=false WHERE displayinlistnoprogram is null" );
         executeSql( "UPDATE patientidentifiertype SET displayinlistnoprogram=false WHERE displayinlistnoprogram is null" );
+
+        executeSql( "ALTER TABLE patientattribute DROP COLUMN displayedinlist" );
+        executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN persondisplayname" );
         
         updateProgramAttributes();
     }
@@ -320,9 +323,6 @@
         
         executeSql( "DROP TABLE program_patientattributes" );
         executeSql( "DROP TABLE program_patientidentifiertypes" );
-
-        executeSql( "ALTER TABLE patientattribute DROP COLUMN displayedinlist" );
-        executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN persondisplayname" );
     }
     
     private void updateUid()

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2014-01-15 10:26:26 +0000
@@ -19,7 +19,7 @@
 
     <property name="valueType" column="valuetype" not-null="true" />
 
-    <property name="mandatory" column="mandatory" not-null="true" />
+    <property name="mandatory" column="mandatory" />
 
     <property name="groupBy" column="groupby" />