[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update for primaries not set.
jenkins-bot has submitted this change and it was merged. Change subject: Update for primaries not set. .. Update for primaries not set. Bug: T143062 Change-Id: I863d09ea41fc2768901624ba3c0693c6106ac4c0 --- M sites/all/modules/wmf_civicrm/wmf_civicrm.install 1 file changed, 25 insertions(+), 0 deletions(-) Approvals: Ejegg: 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 1d84e5b..9aeb973 100644 --- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install +++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install @@ -2188,3 +2188,28 @@ civicrm_initialize(); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_email WHERE email = 'nob...@wikimedia.org'"); } + +/** + * Fix contacts who have no primary - this has arisen from the dedupes. + * + * I'll probably run this again once I've fixed dedupe to stop creating them + * but this fixes the ~1 contacts who currently don't have an address marked as primary. + * + * Staging : (9 min 16.83 sec) + * + * Bug: T143062 + */ +function wmf_civicrm_update_7250() { + civicrm_initialize(); + CRM_Core_DAO::executeQuery(" +UPDATE civicrm_email SET is_primary = 1 +WHERE id IN (SELECT id FROM + ( +SELECT contact_id, sum(is_primary) as c, e.id +FROM civicrm_email e +INNER JOIN civicrm_contact c ON c.id = contact_id AND is_deleted = 0 +GROUP BY contact_id HAVING c = 0 + ) as i +) + "); +} -- To view, visit https://gerrit.wikimedia.org/r/311850 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I863d09ea41fc2768901624ba3c0693c6106ac4c0 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: EileenGerrit-Reviewer: Awight Gerrit-Reviewer: Cdentinger Gerrit-Reviewer: Ejegg Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update for primaries not set.
Eileen has uploaded a new change for review. https://gerrit.wikimedia.org/r/311850 Change subject: Update for primaries not set. .. Update for primaries not set. Bug: T143062 Change-Id: I863d09ea41fc2768901624ba3c0693c6106ac4c0 --- M sites/all/modules/wmf_civicrm/wmf_civicrm.install 1 file changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/50/311850/1 diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install b/sites/all/modules/wmf_civicrm/wmf_civicrm.install index 1d84e5b..9aeb973 100644 --- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install +++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install @@ -2188,3 +2188,28 @@ civicrm_initialize(); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_email WHERE email = 'nob...@wikimedia.org'"); } + +/** + * Fix contacts who have no primary - this has arisen from the dedupes. + * + * I'll probably run this again once I've fixed dedupe to stop creating them + * but this fixes the ~1 contacts who currently don't have an address marked as primary. + * + * Staging : (9 min 16.83 sec) + * + * Bug: T143062 + */ +function wmf_civicrm_update_7250() { + civicrm_initialize(); + CRM_Core_DAO::executeQuery(" +UPDATE civicrm_email SET is_primary = 1 +WHERE id IN (SELECT id FROM + ( +SELECT contact_id, sum(is_primary) as c, e.id +FROM civicrm_email e +INNER JOIN civicrm_contact c ON c.id = contact_id AND is_deleted = 0 +GROUP BY contact_id HAVING c = 0 + ) as i +) + "); +} -- To view, visit https://gerrit.wikimedia.org/r/311850 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I863d09ea41fc2768901624ba3c0693c6106ac4c0 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Eileen___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits