From cff67e98c3402f1b3e4e8ba8e4e2007cdb983bb5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 24 Jun 2014 14:20:12 +1200 Subject: [PATCH] CRM-14900 use INSERT ignore for states - this is primarily about copy & paste protection --- CRM/Upgrade/Incremental/sql/3.0.alpha1.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/3.0.beta4.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/3.1.5.mysql.tpl | 5 +++-- CRM/Upgrade/Incremental/sql/3.1.beta5.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/3.2.alpha1.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/3.4.1.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/4.1.alpha1.mysql.tpl | 2 +- CRM/Upgrade/Incremental/sql/4.4.beta1.mysql.tpl | 2 +- 9 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CRM/Upgrade/Incremental/sql/3.0.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.0.alpha1.mysql.tpl index b32d5005ff..4986091a38 100644 --- a/CRM/Upgrade/Incremental/sql/3.0.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.0.alpha1.mysql.tpl @@ -534,7 +534,7 @@ -- State / province -- CRM-4534 CRM-4686 CRM-4769 - INSERT INTO civicrm_state_province + INSERT IGNORE INTO civicrm_state_province (id, name, abbreviation, country_id) VALUES (5218, 'Distrito Federal', 'DIF', 1140), diff --git a/CRM/Upgrade/Incremental/sql/3.0.beta4.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.0.beta4.mysql.tpl index a9006b0d14..d5f1d3381d 100644 --- a/CRM/Upgrade/Incremental/sql/3.0.beta4.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.0.beta4.mysql.tpl @@ -23,7 +23,7 @@ WHERE civicrm_navigation.name= 'New Grant'; -- CRM-5048 -INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES +INSERT IGNORE INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES (10010, 1107, "Bar", "Barletta-Andria-Trani"), (10011, 1107, "Fer", "Fermo"), (10012, 1107, "Mon", "Monza e Brianza"); diff --git a/CRM/Upgrade/Incremental/sql/3.1.5.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.1.5.mysql.tpl index 45ed177e75..727814766c 100644 --- a/CRM/Upgrade/Incremental/sql/3.1.5.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.1.5.mysql.tpl @@ -23,10 +23,11 @@ UPDATE civicrm_state_province SET name = 'Keelung City' WHERE id = 4864; -- Create additional Taiwan provinces SELECT @country_id := id from civicrm_country where name = 'Taiwan'; -INSERT INTO civicrm_state_province ( country_id, abbreviation, name ) VALUES +INSERT IGNORE INTO civicrm_state_province ( country_id, abbreviation, name ) VALUES ( @country_id, 'TXG', 'Taichung City' ), ( @country_id, 'KHH', 'Kaohsiung City' ), ( @country_id, 'TPE', 'Taipei City' ), ( @country_id, 'CYI', 'Chiayi City' ), ( @country_id, 'HSZ', 'Hsinchu City' ), -( @country_id, 'TNN', 'Tainan City' ); \ No newline at end of file +( @country_id, 'TNN', 'Tainan City' ); + diff --git a/CRM/Upgrade/Incremental/sql/3.1.beta5.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.1.beta5.mysql.tpl index 03231ab821..bbae207464 100644 --- a/CRM/Upgrade/Incremental/sql/3.1.beta5.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.1.beta5.mysql.tpl @@ -1,7 +1,7 @@ -- CRM-5628 SELECT @country_id := id from civicrm_country where name = 'Haiti'; -INSERT INTO civicrm_state_province ( country_id, abbreviation, name ) VALUES +INSERT IGNORE INTO civicrm_state_province ( country_id, abbreviation, name ) VALUES ( @country_id, 'AR', 'Artibonite' ), ( @country_id, 'CE', 'Centre' ), ( @country_id, 'NI', 'Nippes' ), diff --git a/CRM/Upgrade/Incremental/sql/3.2.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.2.alpha1.mysql.tpl index 8b82805798..931dd095a4 100644 --- a/CRM/Upgrade/Incremental/sql/3.2.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.2.alpha1.mysql.tpl @@ -272,7 +272,7 @@ VALUES (@option_group_id_mt, {localize}'Export Activities'{/localize}, @max_val+1, 'Export Activity', NULL, 0, 0, @max_wt+1, 0, 1, 1); -- CRM-6063 - INSERT INTO civicrm_state_province + INSERT IGNORE INTO civicrm_state_province (`name`, `abbreviation`, `country_id` ) VALUES ( 'Andorra la Vella', '07', 1005 ), diff --git a/CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl index 25e33d1a75..240b0dc961 100644 --- a/CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl @@ -107,7 +107,7 @@ ALTER TABLE `civicrm_contact` MODIFY COLUMN `is_deleted` boolean NOT NULL DEFAUL DELETE FROM `civicrm_state_province` WHERE `name` IN ('Freeport', 'Fresh Creek', 'Governor\'s Harbour' , 'Green Turtle Cay', 'Harbour Island', 'High Rock', 'Kemps Bay', 'Marsh Harbour','Nicholls Town and Berry Islands' ,'Rock Sound','Sandy Point','San Salvador and Rum Cay','Bandundu', 'Bas-Congo' ,'Haut-Congo', 'Kasai-Occidental','Katanga', 'Orientale' ); -INSERT INTO civicrm_state_province +INSERT IGNORE INTO civicrm_state_province (`name`, `abbreviation`, `country_id` ) VALUES ( 'Abaco Islands', 'AB',1212), diff --git a/CRM/Upgrade/Incremental/sql/3.4.1.mysql.tpl b/CRM/Upgrade/Incremental/sql/3.4.1.mysql.tpl index 0fa2f1ea13..1de8e58449 100644 --- a/CRM/Upgrade/Incremental/sql/3.4.1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/3.4.1.mysql.tpl @@ -56,7 +56,7 @@ ALTER TABLE civicrm_custom_field MODIFY start_date_years INT(10); ALTER TABLE civicrm_custom_field MODIFY end_date_years INT(10); -- CRM-8009 -INSERT INTO civicrm_state_province +INSERT IGNORE INTO civicrm_state_province (`name`, `abbreviation`, `country_id` ) VALUES ( 'Toledo' , 'TO', '1198' ), diff --git a/CRM/Upgrade/Incremental/sql/4.1.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.1.alpha1.mysql.tpl index 56b485f65d..e93827333c 100644 --- a/CRM/Upgrade/Incremental/sql/4.1.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.1.alpha1.mysql.tpl @@ -18,7 +18,7 @@ ADD UNIQUE INDEX UI_name ( name ); DELETE FROM civicrm_currency WHERE name = 'EEK'; -- CRM-8769 -INSERT INTO civicrm_state_province +INSERT IGNORE INTO civicrm_state_province (`name`, `abbreviation`, `country_id`) VALUES ('Metropolitan Manila' , 'MNL', '1170'); diff --git a/CRM/Upgrade/Incremental/sql/4.4.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.4.beta1.mysql.tpl index d08e51fe12..ede9a6e3f8 100644 --- a/CRM/Upgrade/Incremental/sql/4.4.beta1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.4.beta1.mysql.tpl @@ -1,6 +1,6 @@ {* file to handle db changes in 4.4.beta1 during upgrade *} -- CRM-13314 Added States for Uruguay -INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES +INSERT IGNORE INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES (NULL, 1229, "FL", "Florida"), (NULL, 1229, "RN", "Rio Negro"), (NULL, 1229, "SJ", "San Jose"); -- 2.25.1