Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14476270
D10849.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10849.diff
View Options
diff --git a/resources/sql/autopatches/20141113.auditdupes.php b/resources/sql/autopatches/20141113.auditdupes.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20141113.auditdupes.php
@@ -0,0 +1,22 @@
+<?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";
diff --git a/src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php b/src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php
--- a/src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php
@@ -27,6 +27,10 @@
'auditorPHID' => array(
'columns' => array('auditorPHID', 'auditStatus'),
),
+ 'key_unique' => array(
+ 'columns' => array('commitPHID', 'auditorPHID'),
+ 'unique' => true,
+ ),
),
) + parent::getConfiguration();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 2:12 AM (8 h, 38 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6941494
Default Alt Text
D10849.diff (1 KB)
Attached To
Mode
D10849: Audit - delete duplicate audit requests and add unique key
Attached
Detach File
Event Timeline
Log In to Comment