Skip to content

Commit

Permalink
Merge pull request #9679 from seamuslee001/CRM-18464
Browse files Browse the repository at this point in the history
CRM-18464 use safe drop foreign key function to resolve upgrade error…
  • Loading branch information
totten authored Feb 9, 2017
2 parents 4af6fbb + 45412b5 commit 9daa0c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CRM/Upgrade/Incremental/php/FourSeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
* @param string $rev
*/
public function upgrade_4_7_alpha1($rev) {
$this->addTask('Drop action scheudle mapping foreign key', 'dropActionScheudleMappingForeignKey');
$this->addTask('Migrate \'on behalf of\' information to module_data', 'migrateOnBehalfOfInfo');
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
$this->addTask(ts('Migrate Settings to %1', array(1 => $rev)), 'migrateSettings', $rev);
Expand Down Expand Up @@ -780,6 +781,18 @@ public static function addHelpPreAndHelpPostFieldsPriceFieldValue(CRM_Queue_Task
return TRUE;
}

/**
* CRM-18464 Check if Foreign key exists and also drop any index of same name accidentially created.
*
* @param \CRM_Queue_TaskContext $ctx
*
* @return bool
*/
public static function dropActionScheudleMappingForeignKey(CRM_Queue_TaskContext $ctx) {
CRM_Core_BAO_SchemaHandler::safeRemoveFK('civicrm_action_schedule', 'FK_civicrm_action_schedule_mapping_id');
return TRUE;
}

/**
* CRM-18345 Don't delete mailing data on email/phone deletion
* Implemented here in CRM-18526
Expand Down
1 change: 0 additions & 1 deletion CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
-- Add new columns for multilingual purpose
ALTER TABLE `civicrm_action_schedule` ADD COLUMN `filter_contact_language` varchar(128) DEFAULT NULL COMMENT 'Used for multilingual installation';
ALTER TABLE `civicrm_action_schedule` ADD COLUMN `communication_language` varchar(8) DEFAULT NULL COMMENT 'Used for multilingual installation';
ALTER TABLE `civicrm_action_schedule` DROP FOREIGN KEY `FK_civicrm_action_schedule_mapping_id`;
ALTER TABLE `civicrm_action_schedule` MODIFY COLUMN mapping_id varchar(64);
-- Q: Should we validate that local civicrm_action_mapping records have expected IDs?

Expand Down

0 comments on commit 9daa0c7

Please sign in to comment.