Revert "Make `formal_title` field optional"
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 4.5.alpha1.mysql.tpl
CommitLineData
296342b1 1{* file to handle db changes in 4.5.alpha1 during upgrade *}
e171748b
OB
2
3ALTER TABLE `civicrm_contact`
4 ADD COLUMN `formal_title` varchar(64) COMMENT 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)' AFTER `suffix_id`;
aa62b355
OB
5
6ALTER TABLE `civicrm_contact`
7 ADD COLUMN `communication_style_id` int(10) unsigned COMMENT 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.' AFTER `formal_title`,
8 ADD INDEX `index_communication_style_id` (`communication_style_id`);
9
10INSERT INTO
11 `civicrm_option_group` (`name`, {localize field='title'}`title`{/localize}, `is_reserved`, `is_active`)
12VALUES
13 ('communication_style', {localize}'{ts escape="sql"}Communication Style{/ts}'{/localize}, 1, 1);
14
15SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style';
16
17INSERT INTO
18 `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
19VALUES
20 (@option_group_id_communication_style, {localize}'{ts escape="sql"}Formal{/ts}'{/localize} , 1, 'formal' , NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL),
21 (@option_group_id_communication_style, {localize}'{ts escape="sql"}Familiar{/ts}'{/localize}, 2, 'familiar', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL);
d4311a7a
OB
22
23-- Insert menu item at Administer > Communications, above the various Greeting Formats
24
25SELECT @parent_id := `id` FROM `civicrm_navigation` WHERE `name` = 'Communications' AND `domain_id` = {$domainID};
26SELECT @add_weight := MIN(`weight`) FROM `civicrm_navigation` WHERE `name` IN('Email Greeting Formats', 'Postal Greeting Formats', 'Addressee Formats') AND `parent_id` = @parent_id;
27
28UPDATE `civicrm_navigation`
29SET `weight` = `weight`+1
30WHERE `parent_id` = @parent_id
31AND `weight` >= @add_weight;
32
33INSERT INTO `civicrm_navigation`
34 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
35VALUES
36 ( {$domainID}, 'civicrm/admin/options/communication_style&group=communication_style&reset=1', '{ts escape="sql" skip="true"}Communication Style Options{/ts}', 'Communication Style Options', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight );
b97b088e 37
38-- CRM-9988 Change world region of Panama country to America South, Central, North and Caribbean
39UPDATE `civicrm_country` SET `region_id` = 2 WHERE `id` = 1166;