Details
- 
    Type:Bug 
- 
    Status: Done/Fixed
- 
    Priority:Major 
- 
    Resolution: Fixed/Completed
- 
    Affects Version/s: 2.0, 2.1.2, 2.1.4, 2.1
- 
    Fix Version/s: None
- 
    Component/s: Core CiviCRM
- 
    Labels:None
Description
In the upgrade process to 2.0, step 4 migrates data from civicrm_phonecall, civicrm_meeting and civicrm_email_history into civicrm_activity with the SQL file CRM/Upgrade/TwoZero/sql/activity.mysql . However activity.mysql doesn't update rows in civicrm_custom_value which reference these tables.
In step 5, the upgrade process assumes that entity_id values in civicrm_custom_value refer to civicrm_activity, but in the case of rows migrated from civicrm_phonecall or civicrm_meeting this value is incorrect, leading to various SQL failures.
Patch to fix the problem for civicrm_meeting and civicrm_phonecall is attached.