@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 HeraldCondition();
4$conn_w = $table->establishConnection('w');
5
6echo pht(
7 "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n");
8foreach (new LiskMigrationIterator($table) as $condition) {
9 if ($condition->getFieldName() != HeraldAnotherRuleField::FIELDCONST) {
10 continue;
11 }
12
13 $value = $condition->getValue();
14 if (!is_numeric($value)) {
15 continue;
16 }
17 $id = $condition->getID();
18 echo pht('Updating condition %s...', $id)."\n";
19
20 $rule = id(new HeraldRuleQuery())
21 ->setViewer(PhabricatorUser::getOmnipotentUser())
22 ->withIDs(array($value))
23 ->executeOne();
24
25 queryfx(
26 $conn_w,
27 'UPDATE %T SET value = %s WHERE id = %d',
28 $table->getTableName(),
29 json_encode($rule->getPHID()),
30 $id);
31}
32echo pht('Done.')."\n";