Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341476 )

Change subject: Remove obsolete blank address from tracking table.
......................................................................

Remove obsolete blank address from tracking table.

Bug: T159402
Change-Id: I979c34bf1fadfad11a986318cca3edc259ced8f7
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/76/341476/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 52939b5..ecfd56d 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2685,3 +2685,45 @@
   }
 
 }
+
+/**
+ *
+ * Remove obsolete blank address from tracking table.
+ *
+ * The blank_addresses table tracks blanked addresses. This
+ * function removes addresses from that table that were inserted as blanks,
+ * later deleted while still blanks and which did not have an updates made.
+ *
+ * In other words we don't need to track these as they were fully resolved 
already.
+ *
+ * 21590 rows so we don't need to batch.
+ *
+ * Bug: T159402
+ */
+function wmf_civicrm_update_7490() {
+  civicrm_initialize();
+  CRM_Core_DAO::executeQuery("
+    CREATE TABLE blanks_to_go
+    SELECT b.id
+    FROM blank_addresses i
+    INNER JOIN blank_addresses d
+      ON i.id = d.id
+      AND i.log_action  IN ('Insert', 'Initialization')
+      AND d.log_action = 'Delete'
+    LEFT JOIN log_civicrm_address l
+      ON l.id = i.id AND l.log_action = 'Update'
+    WHERE l.id IS NULL
+    ");
+
+  CRM_Core_DAO::executeQuery(
+    "DELETE a
+       FROM blanks_to_go b
+       INNER JOIN blank_addresses a ON a.id = b.id
+     "
+  );
+
+  CRM_Core_DAO::executeQuery(
+    "DROP TABLE blanks_to_go"
+  );
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/341476
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I979c34bf1fadfad11a986318cca3edc259ced8f7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to