Mifos production DB Upgrade

Version Specific Instructions

This upgrade procedure applies to Release G and newer versions of Mifos which now use Liquibase for managing database upgrades.

STEP 1: Unzip Mifos distribution zip (eg. mifos-v2.2.zip)

mifos-v2.2/
   config/
   db/
     bin/
        contract_db.sh
        expand_db.sh
        liquibase.sh
        undo_contract_db.sh
        undo_expand_db.sh
     changesets/  (contain liquibase xml format database changes - http://www.liquibase.org/manual/changeset)
     lib/ (dependencies required for liquibase)
     sql/ (sql scripts not related to upgrade, only used for creating a new Mifos database)
     mifos-db-template.properties (database configuration template used by liquibase)
   INSTALL
   install-ubuntu.sh
   LICENSE
   mifos.war (deploying war will run expansion script automatically)

NOTE: Do not modify any file using an editor.

STEP 2: Copy db/mifos-db-template.properties to db/mifos-db.properties

STEP 3: Edit db/mifos-db.properties and provide values for db username, password, schema name, machine name and port

STEP 4: Give executable permission for all shell script in db/bin/ folder in case of Unix

STEP 5: Stop jetty

STEP 6: Note down date and time in YYYY-MM-dd HH:mm:ss format (eg. 2011-03-30T0:30:0), this will be required later in case of rollback. Doesn't have to be precise to the minutes, just near to the time before running the upgrade.

STEP 7: Run bin/expand_db.sh or batch file in case of Windows (This step can be skipped for small databases). If expand succeeds, should see "Liquibase Update Successful". If this step fails and you want to continue with previous version of Mifos, run db/bin/undo_expand_db.sh. The usage is undo_expand_db.sh YYYY-MM-ddTHH:mm:ss eg: undo_expand_db.sh 2011-03-30T0:30:0

STEP 8: Confirm the changes by querying the databasechangelog table in the updated Mifos database.

STEP 9: Deploy Mifos, start jetty and test new version of Mifos

STEP 10: Stop jetty

STEP 11: Run db/bin/contract_db.sh. If this step fails and you want to continue with previous version of Mifos, run db/bin/undo_contract_db.sh and db/bin/undo_expand_db.sh. The usage of undo_contract_db.sh is same  as in undo_expand_db.sh mentioned above.

STEP 12: Start jetty, test new version of Mifos, Go live.