Introduce new `communication_style` field for Contacts
[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);