@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<?php
2
3$table = new DifferentialRevision();
4$conn_w = $table->establishConnection('w');
5
6// NOTE: We migrate by revision because the relationship table doesn't have
7// an "id" column.
8
9foreach (new LiskMigrationIterator($table) as $revision) {
10 $revision_id = $revision->getID();
11 $revision_phid = $revision->getPHID();
12
13 echo pht('Migrating reviewers for %s...', "D{$revision_id}")."\n";
14
15 $reviewer_phids = queryfx_all(
16 $conn_w,
17 'SELECT objectPHID FROM %T WHERE revisionID = %d
18 AND relation = %s ORDER BY sequence',
19 'differential_relationship',
20 $revision_id,
21 'revw');
22 $reviewer_phids = ipull($reviewer_phids, 'objectPHID');
23
24 if (!$reviewer_phids) {
25 continue;
26 }
27
28 $editor = new PhabricatorEdgeEditor();
29 foreach ($reviewer_phids as $dst) {
30 if (phid_get_type($dst) == PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
31 // At least one old install ran into some issues here. Skip the row if we
32 // can't figure out what the destination PHID is.
33 continue;
34 }
35
36 $editor->addEdge(
37 $revision_phid,
38 DifferentialRevisionHasReviewerEdgeType::EDGECONST,
39 $dst,
40 array(
41 'data' => array(
42 'status' => DifferentialReviewerStatus::STATUS_ADDED,
43 ),
44 ));
45 }
46
47 $editor->save();
48}
49
50echo pht('Done.')."\n";