Merge pull request #19435 from civicrm/5.34
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 4.7.18.mysql.tpl
1 {* file to handle db changes in 4.7.18 during upgrade *}
2
3 -- CRM-20062 New counties of Kenya.
4 SELECT @country_id := max(id) from civicrm_country where iso_code = "KE";
5 INSERT IGNORE INTO civicrm_state_province (country_id, abbreviation, name) VALUES
6 (@country_id, "01", "Baringo"),
7 (@country_id, "02", "Bomet"),
8 (@country_id, "03", "Bungoma"),
9 (@country_id, "04", "Busia"),
10 (@country_id, "05", "Elgeyo/Marakwet"),
11 (@country_id, "06", "Embu"),
12 (@country_id, "07", "Garissa"),
13 (@country_id, "08", "Homa Bay"),
14 (@country_id, "09", "Isiolo"),
15 (@country_id, "10", "Kajiado"),
16 (@country_id, "11", "Kakamega"),
17 (@country_id, "12", "Kericho"),
18 (@country_id, "13", "Kiambu"),
19 (@country_id, "14", "Kilifi"),
20 (@country_id, "15", "Kirinyaga"),
21 (@country_id, "16", "Kisii"),
22 (@country_id, "17", "Kisumu"),
23 (@country_id, "18", "Kitui"),
24 (@country_id, "19", "Kwale"),
25 (@country_id, "20", "Laikipia"),
26 (@country_id, "21", "Lamu"),
27 (@country_id, "22", "Machakos"),
28 (@country_id, "23", "Makueni"),
29 (@country_id, "24", "Mandera"),
30 (@country_id, "25", "Marsabit"),
31 (@country_id, "26", "Meru"),
32 (@country_id, "27", "Migori"),
33 (@country_id, "28", "Mombasa"),
34 (@country_id, "29", "Murang'a"),
35 (@country_id, "30", "Nairobi City"),
36 (@country_id, "31", "Nakuru"),
37 (@country_id, "32", "Nandi"),
38 (@country_id, "33", "Narok"),
39 (@country_id, "34", "Nyamira"),
40 (@country_id, "35", "Nyandarua"),
41 (@country_id, "36", "Nyeri"),
42 (@country_id, "37", "Samburu"),
43 (@country_id, "38", "Siaya"),
44 (@country_id, "39", "Taita/Taveta"),
45 (@country_id, "40", "Tana River"),
46 (@country_id, "41", "Tharaka-Nithi"),
47 (@country_id, "42", "Trans Nzoia"),
48 (@country_id, "43", "Turkana"),
49 (@country_id, "44", "Uasin Gishu"),
50 (@country_id, "45", "Vihiga"),
51 (@country_id, "46", "Wajir"),
52 (@country_id, "47", "West Pokot");
53
54 -- CRM-19993 Fixes for ISO compliance with countries and counties
55 INSERT INTO `civicrm_state_province` (`id`, `country_id`, `abbreviation`, `name`) VALUES
56 (NULL, 1101, "CH", "Chandigarh"),
57 (NULL, 1083, "CP", "Central"),
58 (NULL, 1083, "EP", "Eastern"),
59 (NULL, 1083, "NP", "Northern"),
60 (NULL, 1083, "WP", "Western"),
61 (NULL, 1181, "K", "Saint Kitts"),
62 (NULL, 1181, "N", "Nevis"),
63 (NULL, 1190, "E", "Eastern"),
64 (NULL, 1190, "N", "Northern"),
65 (NULL, 1190, "S", "Southern");
66
67 UPDATE `civicrm_state_province` SET `name`='Uttarakhand', `abbreviation`='UT' WHERE `name` = 'Uttaranchal' AND `abbreviation`='UL';
68 UPDATE `civicrm_state_province` SET `name`='Yunlin County' WHERE `name` = 'Yunlin Conuty';
69 UPDATE `civicrm_country` SET `name`='Palestine, State of' WHERE `name` = 'Palestinian Territory';
70 UPDATE `civicrm_country` SET `name`='Virgin Islands, British' WHERE `name` = 'Virgin Islands,British';
71
72 -- CRM-20102 make case_type_id required
73 ALTER TABLE `civicrm_case` DROP FOREIGN KEY `FK_civicrm_case_case_type_id`;
74 ALTER TABLE `civicrm_case` MODIFY `case_type_id` int(10) unsigned NOT NULL COMMENT 'FK to civicrm_case_type.id';
75 ALTER TABLE `civicrm_case` ADD CONSTRAINT `FK_civicrm_case_case_type_id` FOREIGN KEY (`case_type_id`) REFERENCES `civicrm_case_type` (`id`);
76
77 --- CRM-19715 Remove Close Accounting Period code - now in an extension.
78 DELETE FROM civicrm_navigation
79 WHERE url = 'civicrm/admin/contribute/closeaccperiod?reset=1' AND name = 'Close Accounting Period';