Skip to content

Commit

Permalink
Merge pull request #24706 from seamuslee001/update_indian_states
Browse files Browse the repository at this point in the history
[REF] Update Indian States as per ISO-3166-2
  • Loading branch information
demeritcowboy authored Oct 11, 2022
2 parents f90137a + 8355d86 commit 1b878aa
Show file tree
Hide file tree
Showing 3 changed files with 4,166 additions and 4,119 deletions.
15 changes: 15 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.56.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{* file to handle db changes in 5.56.alpha1 during upgrade *}

-- Add in missing indian states as per iso-3166-2
SELECT @indianCountryID := id FROM civicrm_country WHERE name = 'India' AND iso_code = 'IN';
INSERT INTO civicrm_state_province (country_id, abbreviation, name) VALUES
(@indianCountryID, "LA", "Ladākh"),
(@indianCountryID, "DH", "Dādra and Nagar Haveli and Damān and Diu");

SELECT @DHStateID := id from civicrm_state_province WHERE country_id = @indianCountryID AND abbreviation = 'DH';

UPDATE civicrm_address ca
INNER JOIN civicrm_state_province csp ON csp.id = ca.state_province_id
SET ca.state_province_id = @DHStateID
WHERE csp.country_id = @indianCountryID AND csp.abbreviation IN ("DN", "DD");

UPDATE civicrm_state_province SET is_active = 0 WHERE country_id = @indianCountryID AND abbreviation IN ("DN", "DD");
Loading

0 comments on commit 1b878aa

Please sign in to comment.