upgrade changes for CRM-15765

Upgrade handling and SQL changes for https://issues.civicrm.org/jira/browse/CRM-15765