Grameen Koota Database Upgrade

Here are some notes about upgrading Grameen Koota's v1.0 Mifos database.

The database is from Iteration 15 - that is, the last version before the database version table was added.

Some of the upgrade steps are SQL, and some are java-only. The SQL steps can be run by the Mifos app automatically, or can be run manually. The java upgrade steps can only be run by the Mifos application.

I determined the problem in upgrading automatically to 197 was with duplicated login_names in the personnel table. I wrote a small script to find the duplicate names and append numbers to the login_names to make them unique, as this will satisfy the database constraint that was causing the upgrade to fail.

This script is checked in here.

  • I took a backup of the existing v1.0 version database to ensure that I could roll-back successfully to an earlier version if the upgrade process did not work. Backups are essential at each stage to ensure that you can return to a previous step without having to start again, if any issues are encountered.
  • I ran the python cleanup script and it corrected the duplicate entries. Alternatively, since this script only functions if MySQL is being run on port 3306, you can manually clean up the data. Run the following query to ensure you have successfully removed all duplicates:
    SELECT login_name, count(login_name) AS count FROM personnel
     GROUP BY login_name HAVING count > 1 ORDER BY count;
    
    This query should return no results once you have cleaned up the duplicate entries.
  • To add the database version, I ran the script in mifostrunk/mifos/sql/add-version.sql
  • I took a backup of the DB again, which has the cleaned up login names and DB version number added.
  • I deployed a version of the application in tomcat that corresponds with database version 180. (revision 12550) in order to have the application upgrade the DB to v180 from v100.
  • I then started the app. It upgraded correctly to version 180.
  • I stopped the app and the database.
  • I made a backup of the database.
  • I then deployed a version of the Mifos application in tomcat from the latest working source (revision 13047), corresponding to database version 197
  • I started the application. It upgraded to DB 197 and started correctly.
  • I did some manual tests, and all looks good. The DB is now ready for full testing to ensure that all functionality works correctly with the upgraded production database.
  • I now shut down my application to create a custom configuration properties file to set my desired rounding rules for the new financial calculation methods for loans in v1.1. Instructions on how to do that are located on the Configuring Mifos page. I changed the values for the following fields:
  1. Mutability: always # Type: string (can only be CEILING or FLOOR or HALF_UP) AccountingRules.CurrencyRoundingMode=HALF_UP
  1. Mutability: always # Type: string (can only be CEILING or FLOOR or HALF_UP) AccountingRules.InitialRoundingMode=HALF_UP
  1. Mutability: always # Type: string (can only be CEILING or FLOOR or HALF_UP) AccountingRules.FinalRoundingMode=CEILING