Procedure to migrate database to CiviEngage format
=====================================================
1. After the db has been upgraded, import migrate/custom_groups_fields.sql file to -

A. For all $customGroups in DB2
if ( $customGroups IS ONE OF standard custom group generated by xml )
=> Fix table_name column to remove $_id suffix;

B. For all $customFields in DB2
if ( $customFields IS ONE OF standard custom field generated by xml )
=> Fix column_name column to remove $_id suffix;

C. Fix columns and tables which does not match even after removing $_id suffix.

Note above steps don't do any thing to structure / data of custom_value_*_id tables.

2. Import migrate/custom_tables.sql file to copy standard custom_value_* tables to the db. After importing the file, the db will have two different sets of tables -
custom_value_* tables,
custom_value_*_$id tables. 

3. Import migrate/custom_data.sql file (after reading the note below) to - 

A. Migrate data from custom "custom_value_*_$id" -to-> "custom_value_*" tables. 

B. Migrate core data from "custom_value_*_$id" tables to contact core fields.

C. Migrate columns to be retained with data, from "custom_value_*_$id" -to-> "custom_value_*" tables.

B. Drop old "custom_value_*" tables at the end.

Note: Above script uses hard-coded old column and table names. Please verify these names and adjust if required before importing.

4. Import migrate/profiles.sql to re-create all standard profiles. Note rest of the extra profile's fields will need to be updated manually, to match with migrated custom groups and fields.
