mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
310373ebc4
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
22 lines
582 B
PHP
22 lines
582 B
PHP
<?php
|
|
|
|
$table = new PhabricatorRepositoryAuditRequest();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
echo "Removing duplicate Audit requests...\n";
|
|
$seen_audit_map = array();
|
|
foreach (new LiskMigrationIterator($table) as $request) {
|
|
$commit_phid = $request->getCommitPHID();
|
|
$auditor_phid = $request->getAuditorPHID();
|
|
if (isset($seen_audit_map[$commit_phid][$auditor_phid])) {
|
|
$request->delete();
|
|
}
|
|
|
|
if (!isset($seen_audit_map[$commit_phid])) {
|
|
$seen_audit_map[$commit_phid] = array();
|
|
}
|
|
|
|
$seen_audit_map[$commit_phid][$auditor_phid] = 1;
|
|
}
|
|
|
|
echo "Done.\n";
|