1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00
phorge-phorge/resources/sql/patches/20131004.dxreviewers.php
epriestley 8cbfb49b4e Remove all edge events
Summary:
Ref T5245. These were a bad idea.

We no longer need actors for edge edits either, so remove those. Generally, edges have fit into the policy model as pure/low-level infrastructure, and they do not have any policy or capability information in and of themselves.

Test Plan: `grep`

Reviewers: chad, btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5245

Differential Revision: https://secure.phabricator.com/D9840
2014-07-17 15:41:42 -07:00

51 lines
1.3 KiB
PHP

<?php
$table = new DifferentialRevision();
$conn_w = $table->establishConnection('w');
// NOTE: We migrate by revision because the relationship table doesn't have
// an "id" column.
foreach (new LiskMigrationIterator($table) as $revision) {
$revision_id = $revision->getID();
$revision_phid = $revision->getPHID();
echo "Migrating reviewers for D{$revision_id}...\n";
$reviewer_phids = queryfx_all(
$conn_w,
'SELECT objectPHID FROM %T WHERE revisionID = %d
AND relation = %s ORDER BY sequence',
'differential_relationship',
$revision_id,
'revw');
$reviewer_phids = ipull($reviewer_phids, 'objectPHID');
if (!$reviewer_phids) {
continue;
}
$editor = new PhabricatorEdgeEditor();
foreach ($reviewer_phids as $dst) {
if (phid_get_type($dst) == PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
// At least one old install ran into some issues here. Skip the row if we
// can't figure out what the destination PHID is. See here:
// https://github.com/phacility/phabricator/pull/507
continue;
}
$editor->addEdge(
$revision_phid,
PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER,
$dst,
array(
'data' => array(
'status' => DifferentialReviewerStatus::STATUS_ADDED,
),
));
}
$editor->save();
}
echo "Done.\n";