| 1 | {* file to handle db changes in 4.6.alpha7 during upgrade *} |
| 2 | |
| 3 | -- location_type_id should have default NULL, not invalid id 0 |
| 4 | ALTER TABLE civicrm_mailing CHANGE `location_type_id` `location_type_id` int(10) unsigned DEFAULT NULL COMMENT 'With email_selection_method, determines which email address to use'; |
| 5 | |
| 6 | -- CRM-15970 - Track authorship of of A/B tests |
| 7 | ALTER TABLE civicrm_mailing_abtest |
| 8 | ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', |
| 9 | ADD COLUMN `created_date` datetime COMMENT 'When was this item created', |
| 10 | ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, |
| 11 | ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, |
| 12 | ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL; |
| 13 | |
| 14 | -- Move A/B test option-values into code |
| 15 | DELETE FROM civicrm_option_group WHERE name IN ('mailing_ab_status', 'mailing_ab_testing_criteria', 'mailing_ab_winner_criteria'); |
| 16 | UPDATE civicrm_mailing_abtest SET testing_criteria = 'subject' WHERE testing_criteria_id = 1; |
| 17 | UPDATE civicrm_mailing_abtest SET testing_criteria = 'from' WHERE testing_criteria_id = 2; |
| 18 | UPDATE civicrm_mailing_abtest SET testing_criteria = 'full_email' WHERE testing_criteria_id = 3; |
| 19 | UPDATE civicrm_mailing_abtest SET winner_criteria = 'open' WHERE winner_criteria_id = 1; |
| 20 | UPDATE civicrm_mailing_abtest SET winner_criteria = 'unique_click' WHERE winner_criteria_id = 2; |
| 21 | UPDATE civicrm_mailing_abtest SET winner_criteria = 'link_click' WHERE winner_criteria_id = 3; |
| 22 | |
| 23 | ALTER TABLE civicrm_mailing_abtest |
| 24 | DROP COLUMN `testing_criteria_id`, |
| 25 | DROP COLUMN `winner_criteria_id`; |