From 2af0b023b1f25c8e0418d7b0fb8076f7fe1a866d Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 26 Apr 2016 16:58:21 -0400 Subject: [PATCH] CRM-16846 - Fix missing upgrade steps --- CRM/Upgrade/Incremental/php/FourSeven.php | 26 +++++++++ CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl | 31 ----------- CRM/Upgrade/Incremental/sql/4.7.2.mysql.tpl | 28 ---------- CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl | 4 -- CRM/Upgrade/Incremental/sql/4.7.7.mysql.tpl | 62 +++++++++++++++++++++ 5 files changed, 88 insertions(+), 63 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 971c58486b..bd1c17560a 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -151,6 +151,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base * @param string $rev */ public function upgrade_4_7_1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Add Index to civicrm_contribution creditnote_id field', 'addIndexContributionCreditNoteID'); } @@ -160,6 +161,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base * @param string $rev */ public function upgrade_4_7_2($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Fix Index on civicrm_financial_item combined entity_id + entity_table', 'addCombinedIndexFinancialItemEntityIDEntityType'); $this->addTask('enable financial account relationships for chargeback & refund', 'addRefundAndChargeBackAccountsIfNotExist'); $this->addTask('Add Index to civicrm_contribution.source', 'addIndexContributionSource'); @@ -171,6 +173,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base * @param string $rev */ public function upgrade_4_7_3($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Add Index to civicrm_contribution.total_amount', 'addIndexContributionAmount'); } @@ -180,16 +183,39 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base * @param string $rev */ public function upgrade_4_7_4($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Add Contact Deleted by Merge Activity Type', 'addDeletedByMergeActivityType'); } + /** + * Upgrade function. + * + * @param string $rev + */ public function upgrade_4_7_7($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); // https://issues.civicrm.org/jira/browse/CRM-18006 if (CRM_Core_DAO::checkTableExists('civicrm_install_canary')) { CRM_Core_DAO::executeQuery('ALTER TABLE civicrm_install_canary ENGINE=InnoDB'); } } + /* + * Important! All upgrade functions MUST call the 'runSql' task. + * Uncomment and use the following template for a new upgrade version + * (change the x in the function name): + */ + + // /** + // * Upgrade function. + // * + // * @param string $rev + // */ + // public function upgrade_4_7_x($rev) { + // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); + // // Additional tasks here... + // } + /** * CRM-16354 * diff --git a/CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl index 3dc0b34d14..65ea99d5a1 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl @@ -1,32 +1 @@ {* file to handle db changes in 4.7.1 during upgrade *} -# CRM-17852 - Misspeled state names in Estonia/Lithuania - -#Estonia - -SET @EstoniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Estonia'); - -UPDATE civicrm_state_province SET name = 'Harjumaa' where name='Harjumsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Hiiumaa' where name='Hitumea' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Ida-Virumaa' where name='Ida-Virumsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Jõgevamaa' where name='Jogevamsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Järvamaa' where name='Jarvamsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Läänemaa' where name='Lasnemsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Lääne-Virumaa' where name='Laane-Virumaa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Põlvamaa' where name='Polvamea' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Pärnumaa' where name='Parnumsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Raplamaa' where name='Raplamsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Saaremaa' where name='Saaremsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Tartumaa' where name='Tartumsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Viljandimaa' where name='Viljandimsa' AND country_id = @EstoniaCountryId; -UPDATE civicrm_state_province SET name = 'Võrumaa' where name='Vorumaa' AND country_id = @EstoniaCountryId; - -#Lithuania - -SET @LithuaniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Lithuania'); - -UPDATE civicrm_state_province SET name = 'Klaipėdos Apskritis' where name='Klaipedos Apskritis' AND country_id = @LithuaniaCountryId; -UPDATE civicrm_state_province SET name = 'Marijampolės Apskritis' where name='Marijampoles Apskritis' AND country_id = @LithuaniaCountryId; -UPDATE civicrm_state_province SET name = 'Panevėžio Apskritis' where name='Panevezio Apskritis' AND country_id = @LithuaniaCountryId; -UPDATE civicrm_state_province SET name = 'Šiaulių Apskritis' where name='Sisuliu Apskritis' AND country_id = @LithuaniaCountryId; -UPDATE civicrm_state_province SET name = 'Tauragės Apskritis' where name='Taurages Apskritis' AND country_id = @LithuaniaCountryId; -UPDATE civicrm_state_province SET name = 'Telšių Apskritis' where name='Telsiu Apskritis' AND country_id = @LithuaniaCountryId; diff --git a/CRM/Upgrade/Incremental/sql/4.7.2.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.2.mysql.tpl index 2e87e38e65..8a258e453a 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.2.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.2.mysql.tpl @@ -1,29 +1 @@ {* file to handle db changes in 4.7.2 during upgrade *} -# CRM-18014 - Missspeled county names in Sweden - -#Sweden - -SET @SwedenCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Sweden'); - -UPDATE civicrm_state_province SET name = 'Blekinge län' where name='Blekinge lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Dalarnas län' where name='Dalarnas lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Gävleborgs län' where name='Gavleborge lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Gotlands län' where name='Gotlands lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Hallands län' where name='Hallands lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Jämtlands län' where name='Jamtlande lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Jönköpings län' where name='Jonkopings lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Kalmar län' where name='Kalmar lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Kronobergs län' where name='Kronoberge lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Norrbottens län' where name='Norrbottena lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Örebro län' where name='Orebro lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Östergötlands län' where name='Ostergotlands lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Skåne län' where name='Skane lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Södermanlands län' where name='Sodermanlands lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Stockholms län' where name='Stockholms lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Uppsala län' where name='Uppsala lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Värmlands län' where name='Varmlanda lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Västerbottens län' where name='Vasterbottens lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Västernorrlands län' where name='Vasternorrlands lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Västmanlands län' where name='Vastmanlanda lan' AND country_id = @SwedenCountryId; -UPDATE civicrm_state_province SET name = 'Västra Götalands län' where name='Vastra Gotalands lan' AND country_id = @SwedenCountryId; - diff --git a/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl index 4755bbea29..1079b1ad15 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl @@ -1,5 +1 @@ {* file to handle db changes in 4.7.4 during upgrade *} -{include file='../CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl'} - --- CRM-18037 - update preferred mail format to set as default -UPDATE `civicrm_contact` SET `preferred_mail_format` = 'Both' WHERE `preferred_mail_format` IS NULL; diff --git a/CRM/Upgrade/Incremental/sql/4.7.7.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.7.mysql.tpl index a6430c44a5..ce446ac804 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.7.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.7.mysql.tpl @@ -1,4 +1,66 @@ {* file to handle db changes in 4.7.7 during upgrade *} +# CRM-17852 - Misspeled state names in Estonia/Lithuania +#Estonia + +SET @EstoniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Estonia'); + +UPDATE civicrm_state_province SET name = 'Harjumaa' where name='Harjumsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Hiiumaa' where name='Hitumea' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Ida-Virumaa' where name='Ida-Virumsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Jõgevamaa' where name='Jogevamsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Järvamaa' where name='Jarvamsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Läänemaa' where name='Lasnemsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Lääne-Virumaa' where name='Laane-Virumaa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Põlvamaa' where name='Polvamea' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Pärnumaa' where name='Parnumsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Raplamaa' where name='Raplamsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Saaremaa' where name='Saaremsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Tartumaa' where name='Tartumsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Viljandimaa' where name='Viljandimsa' AND country_id = @EstoniaCountryId; +UPDATE civicrm_state_province SET name = 'Võrumaa' where name='Vorumaa' AND country_id = @EstoniaCountryId; + +#Lithuania + +SET @LithuaniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Lithuania'); + +UPDATE civicrm_state_province SET name = 'Klaipėdos Apskritis' where name='Klaipedos Apskritis' AND country_id = @LithuaniaCountryId; +UPDATE civicrm_state_province SET name = 'Marijampolės Apskritis' where name='Marijampoles Apskritis' AND country_id = @LithuaniaCountryId; +UPDATE civicrm_state_province SET name = 'Panevėžio Apskritis' where name='Panevezio Apskritis' AND country_id = @LithuaniaCountryId; +UPDATE civicrm_state_province SET name = 'Šiaulių Apskritis' where name='Sisuliu Apskritis' AND country_id = @LithuaniaCountryId; +UPDATE civicrm_state_province SET name = 'Tauragės Apskritis' where name='Taurages Apskritis' AND country_id = @LithuaniaCountryId; +UPDATE civicrm_state_province SET name = 'Telšių Apskritis' where name='Telsiu Apskritis' AND country_id = @LithuaniaCountryId; + +# CRM-18014 - Missspeled county names in Sweden + +SET @SwedenCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Sweden'); + +UPDATE civicrm_state_province SET name = 'Blekinge län' where name='Blekinge lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Dalarnas län' where name='Dalarnas lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Gävleborgs län' where name='Gavleborge lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Gotlands län' where name='Gotlands lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Hallands län' where name='Hallands lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Jämtlands län' where name='Jamtlande lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Jönköpings län' where name='Jonkopings lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Kalmar län' where name='Kalmar lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Kronobergs län' where name='Kronoberge lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Norrbottens län' where name='Norrbottena lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Örebro län' where name='Orebro lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Östergötlands län' where name='Ostergotlands lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Skåne län' where name='Skane lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Södermanlands län' where name='Sodermanlands lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Stockholms län' where name='Stockholms lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Uppsala län' where name='Uppsala lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Värmlands län' where name='Varmlanda lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Västerbottens län' where name='Vasterbottens lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Västernorrlands län' where name='Vasternorrlands lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Västmanlands län' where name='Vastmanlanda lan' AND country_id = @SwedenCountryId; +UPDATE civicrm_state_province SET name = 'Västra Götalands län' where name='Vastra Gotalands lan' AND country_id = @SwedenCountryId; + +{include file='../CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl'} + +-- CRM-18037 - update preferred mail format to set as default +UPDATE `civicrm_contact` SET `preferred_mail_format` = 'Both' WHERE `preferred_mail_format` IS NULL; + -- Fix weight interchange of `Extensions` and `Connections` navigation menu SELECT @parent_id := id from `civicrm_navigation` where name = 'System Settings' AND domain_id = {$domainID}; UPDATE -- 2.25.1