@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Audit - delete duplicate audit requests and add unique key

Summary: Fixes T1768. This is mostly a data cleanliness issue as duplicate rows don't really do anything, but let's clear it up now.

Test Plan: made some duplicate rows by adding the same auditor multiple times. ran ./bin/storage upgrade and it worked perfectly!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T1768

Differential Revision: https://secure.phabricator.com/D10849

+26
+22
resources/sql/autopatches/20141113.auditdupes.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorRepositoryAuditRequest(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + echo "Removing duplicate Audit requests...\n"; 7 + $seen_audit_map = array(); 8 + foreach (new LiskMigrationIterator($table) as $request) { 9 + $commit_phid = $request->getCommitPHID(); 10 + $auditor_phid = $request->getAuditorPHID(); 11 + if (isset($seen_audit_map[$commit_phid][$auditor_phid])) { 12 + $request->delete(); 13 + } 14 + 15 + if (!isset($seen_audit_map[$commit_phid])) { 16 + $seen_audit_map[$commit_phid] = array(); 17 + } 18 + 19 + $seen_audit_map[$commit_phid][$auditor_phid] = 1; 20 + } 21 + 22 + echo "Done.\n";
+4
src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php
··· 27 27 'auditorPHID' => array( 28 28 'columns' => array('auditorPHID', 'auditStatus'), 29 29 ), 30 + 'key_unique' => array( 31 + 'columns' => array('commitPHID', 'auditorPHID'), 32 + 'unique' => true, 33 + ), 30 34 ), 31 35 ) + parent::getConfiguration(); 32 36 }