*MUST READ* if your MFI currently uses Additional Fields (Custom Fields) AND/OR Surveys in Mifos 1.6.x and earlier.

During the upgrade to Mifos 2.0, Additional Fields and Surveys are automatically migrated to the Question Group functionality.

Survey Migration

Additional Fields Migration

Post Migration

How might Migration not be successful?

If successful

If NOT successful

Known Issues

MIFOS-4892    : Survey Migration not mapping single select or choice responses correctly

The data which is affected by this issue requires manual verification at database level using this query.

SELECT distinct(qgr.response)
   FROM question_group qg, question_group_instance qgi, question_group_response qgr, sections_questions s, questions q
   WHERE qg.id=qgi.question_group_id AND qgi.id=qgr.question_group_instance_id AND qgr.sections_questions_id=s.id
   AND s.question_id=q.question_id AND (q.answer_type=6 OR q.answer_type=4) AND is_ppi=0;

If you have zero rows as result then your database is NOT affected by this issue. Make sure you have applied query in correctly.

If you are affected.
The result of this query will be id(numbers) instead of response text.

STEP 1: make backup of question_group_response table.

mysqldump -u mifos -pmifos mifos question_group_response > qgr.sql

STEP 2: Run the update query to fix the data (NOTE: This query should be run once only, running twice or more will corrupt responses column, then you would have to restore the question_group_table and try again)
(This query only affects question_group_response table, so if something goes wrong you can restore the question_group_response table)

UPDATE question_group_response qgr
    JOIN  ( SELECT qgr.id, qgr.response, q.question_id
            FROM question_group qg, question_group_instance qgi, question_group_response qgr, sections_questions s, questions q
            WHERE qg.id=qgi.question_group_id AND qgi.id=qgr.question_group_instance_id AND qgr.sections_questions_id=s.id
            AND s.question_id=q.question_id AND (q.answer_type=6 OR q.answer_type=4) AND is_ppi=0
           ) r     
SET qgr.response=(SELECT choice_text FROM question_choices WHERE choice_id=qgr.response) WHERE qgr.id=r.id;

STEP 3: check for mysql warnings/errors (there should NOT be any warning or error after running the query).

mysql> SHOW WARNINGS