jenkins-bot has submitted this change and it was merged.
Change subject: Explicitly create table, break up updates
......................................................................
Explicitly create table, break up updates
Try to minimize civicrm_address locking.
Bug: T148578
Change-Id: I3d981fe972e883f5b990c1d27c8616a3b3e4f6b8
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 21 insertions(+), 7 deletions(-)
Approvals:
Eileen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 9fc3a35..3574e7a 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2372,21 +2372,35 @@
function wmf_civicrm_update_7320() {
civicrm_initialize();
CRM_Core_DAO::executeQuery("
- CREATE TEMPORARY TABLE civicrm_address_geocode
- SELECT id, LEFT(postal_code, 5) AS zip
+ CREATE TEMPORARY TABLE civicrm_address_geocode (
+ id INT PRIMARY KEY,
+ zip CHAR(5),
+ latitude DOUBLE,
+ longitude DOUBLE,
+ timezone VARCHAR(8)
+ )");
+
+ CRM_Core_DAO::executeQuery("INSERT INTO civicrm_address_geocode (id, zip)
+ SELECT id, LEFT(postal_code, 5)
FROM civicrm_address
WHERE country_id = (SELECT id FROM civicrm_country WHERE iso_code = 'US')
");
- CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_address_geocode ADD INDEX
index_id(id)");
CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_address_geocode ADD INDEX
index_zip(zip)");
+
+ CRM_Core_DAO::executeQuery("
+ UPDATE civicrm_address_geocode c
+ INNER JOIN wmf_zip_geo g ON c.zip = g.zip
+ SET c.latitude = g.latitude,
+ c.longitude = g.longitude,
+ c.timezone = g.timezone
+ ");
CRM_Core_DAO::executeQuery("
UPDATE civicrm_address a
INNER JOIN civicrm_address_geocode c ON c.id = a.id
- INNER JOIN wmf_zip_geo g ON c.zip = g.zip
- SET a.geo_code_1 = g.latitude,
- a.geo_code_2 = g.longitude,
- a.timezone = g.timezone
+ SET a.geo_code_1 = c.latitude,
+ a.geo_code_2 = c.longitude,
+ a.timezone = c.timezone
");
}
--
To view, visit https://gerrit.wikimedia.org/r/319256
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3d981fe972e883f5b990c1d27c8616a3b3e4f6b8
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits