Commit e48650b2 authored by Jamie McClelland's avatar Jamie McClelland

fixing upgrade script to properly handle the db transition.

parent 2fcd105f
......@@ -40,10 +40,10 @@ class CRM_Petitionemail_Upgrader extends CRM_Petitionemail_Upgrader_Base {
$dao = CRM_Core_DAO::executeQuery($sql);
while($dao->fetch()) {
$target = '"' . $dao->recipient_name . '" <' . $dao->recipient_email . '>';
$sql = "UPDATE civicrm_petition_email_target SET petition_id = %0, recipients = %1";
$sql = "UPDATE civicrm_petition_email SET recipients = %0 WHERE petition_id = %1";
$params = array(
0 => array($dao->petition_id, 'Integer'),
1 => array($target, 'String')
0 => array($target, 'String'),
1 => array($dao->petition_id, 'Integer'),
);
CRM_Core_DAO::executeQuery($sql, $params);
}
......
......@@ -4,5 +4,5 @@
ALTER TABLE civicrm_petition_email DROP COLUMN `recipient_email`;
ALTER TABLE civicrm_petition_email DROP COLUMN `recipient_name`;
ALTER TABLE civicrm_petition_email CHANGE COLUMN message_field message_field varchar(128);
ALTER TABLE civicrm_petition_email ADD COLUMN `location_type_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The location type that should be used when selecting the target email address.' AFTER group_id;
ALTER TABLE civicrm_petition_email ADD COLUMN `location_type_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The location type that should be used when selecting the target email address.';
ALTER TABLE civicrm_petition_email ADD CONSTRAINT `FK_civicrm_petition_email_petition_id` FOREIGN KEY (`petition_id`) REFERENCES `civicrm_survey` (`id`) ON DELETE CASCADE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment