Merge pull request #4054 from eileenmcnaughton/CRM-15237
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 3.4.5.mysql.tpl
1 -- CRM-8248
2 {include file='../CRM/Upgrade/3.4.5.msg_template/civicrm_msg_template.tpl'}
3
4 -- CRM-8348
5
6 CREATE TABLE IF NOT EXISTS civicrm_action_log (
7 id int UNSIGNED NOT NULL AUTO_INCREMENT,
8 contact_id int UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID',
9 entity_id int UNSIGNED NOT NULL COMMENT 'FK to id of the entity that the action was performed on. Pseudo - FK.',
10 entity_table varchar(255) COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
11 action_schedule_id int UNSIGNED NOT NULL COMMENT 'FK to the action schedule that this action originated from.',
12 action_date_time DATETIME NULL DEFAULT NULL COMMENT 'date time that the action was performed on.',
13 is_error TINYINT( 4 ) NULL DEFAULT '0' COMMENT 'Was there any error sending the reminder?',
14 message TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Description / text in case there was an error encountered.',
15 repetition_number INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.',
16 PRIMARY KEY ( id ),
17 CONSTRAINT FK_civicrm_action_log_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
18 CONSTRAINT FK_civicrm_action_log_action_schedule_id FOREIGN KEY (action_schedule_id) REFERENCES civicrm_action_schedule(id) ON DELETE CASCADE
19 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
20
21 -- CRM-8370
22 ALTER TABLE `civicrm_action_log` CHANGE `repetition_number` `repetition_number` INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.';
23
24 -- CRM-8085
25 UPDATE civicrm_mailing SET domain_id = {$domainID} WHERE domain_id IS NULL;
26
27 -- CRM-8402, CRM-8679
28 DELETE et2.* from civicrm_entity_tag et1
29 INNER JOIN civicrm_entity_tag et2 ON et1.entity_table = et2.entity_table AND et1.entity_id = et2.entity_id AND et1.tag_id = et2.tag_id
30 WHERE et1.id < et2.id;
31
32 ALTER TABLE civicrm_entity_tag
33 DROP INDEX index_entity;
34
35 ALTER TABLE civicrm_entity_tag
36 ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id );
37
38 -- CRM-8513
39
40 SELECT @report_template_gid := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';
41
42 {if $multilingual}
43 {foreach from=$locales item=locale}
44 UPDATE civicrm_option_value SET label_{$locale} = 'Pledge Report (Detail)', description_{$locale} = 'Pledge Report' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';
45 {/foreach}
46 {else}
47 UPDATE civicrm_option_value SET label = 'Pledge Report (Detail)', description = 'Pledge Report' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';
48 {/if}
49
50 UPDATE civicrm_option_value SET name = 'CRM_Report_Form_Pledge_Detail', value = 'pledge/detail' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';
51
52 UPDATE civicrm_report_instance SET report_id = 'pledge/detail' WHERE report_id = 'pledge/summary';
53
54 SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @report_template_gid;
55 SELECT @pledgeCompId := MAX(id) FROM civicrm_component where name = 'CiviPledge';
56 INSERT INTO civicrm_option_value
57 (option_group_id, {localize field='label'}label{/localize}, value, name, weight, {localize field='description'}description{/localize}, is_active, component_id) VALUES
58 (@report_template_gid, {localize}'Pledge Summary Report'{/localize}, 'pledge/summary', 'CRM_Report_Form_Pledge_Summary', @weight := @weight + 1, {localize}'Pledge Summary Report.'{/localize}, 1, @pledgeCompId);
59
60 -- CRM-8519
61 UPDATE civicrm_payment_processor
62 SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxpay.aspx'
63 WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxpay.aspx'
64 OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay.aspx';
65
66 UPDATE civicrm_payment_processor
67 SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
68 WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxaccess.aspx'
69 OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay/pxaccess.aspx';
70
71 UPDATE civicrm_payment_processor_type
72 SET url_site_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx',
73 url_site_test_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
74 WHERE name = 'Payment_Express';
75
76
77 -- CRM-8125
78 SELECT @option_group_id_languages := MAX(id) FROM civicrm_option_group WHERE name = 'languages';
79 SELECT @languages_max_weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_languages;
80
81 {if $multilingual}
82 {foreach from=$locales item=locale}
83 UPDATE civicrm_option_value SET label_{$locale} = '{ts escape="sql"}Persian (Iran){/ts}' WHERE value = 'fa' AND option_group_id = @option_group_id_languages;
84 {/foreach}
85 {else}
86 UPDATE civicrm_option_value SET label = '{ts escape="sql"}Persian (Iran){/ts}' WHERE value = 'fa' AND option_group_id = @option_group_id_languages;
87 {/if}
88
89 INSERT INTO civicrm_option_value
90 (option_group_id, is_default, is_active, name, value, {localize field='label'}label{/localize}, weight)
91 VALUES
92 (@option_group_id_languages, 0, 1, 'de_CH', 'de', {localize}'{ts escape="sql"}German (Swiss){/ts}'{/localize}, @weight := @languages_max_weight + 1),
93 (@option_group_id_languages, 0, 1, 'es_PR', 'es', {localize}'{ts escape="sql"}Spanish; Castilian (Puerto Rico){/ts}'{/localize}, @weight := @languages_max_weight + 2);
94
95 -- CRM-8218, contact dashboard changes
96 {if $alterContactDashboard}
97 ALTER TABLE `civicrm_dashboard` DROP `content`, DROP `created_date`;
98 ALTER TABLE `civicrm_dashboard_contact` ADD `content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `weight`, ADD `created_date` DATETIME NULL DEFAULT NULL AFTER `content`;
99 {/if}