@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 HarbormasterBuildPlan();
4$conn_w = $table->establishConnection('w');
5$viewer = PhabricatorUser::getOmnipotentUser();
6
7// Since HarbormasterBuildStepQuery has been updated to handle the
8// correct order, we can't use the built in database access.
9
10foreach (new LiskMigrationIterator($table) as $plan) {
11 $planname = $plan->getName();
12 echo pht('Migrating steps in %s...', $planname)."\n";
13
14 $rows = queryfx_all(
15 $conn_w,
16 'SELECT id, sequence FROM harbormaster_buildstep '.
17 'WHERE buildPlanPHID = %s '.
18 'ORDER BY id ASC',
19 $plan->getPHID());
20
21 $sequence = 1;
22 foreach ($rows as $row) {
23 $id = $row['id'];
24 $existing = $row['sequence'];
25 if ($existing != 0) {
26 echo " - ".pht('%d (already migrated)...', $id)."\n";
27 continue;
28 }
29 echo " - ".pht('%d to position %s...', $id, $sequence)."\n";
30 queryfx(
31 $conn_w,
32 'UPDATE harbormaster_buildstep '.
33 'SET sequence = %d '.
34 'WHERE id = %d',
35 $sequence,
36 $id);
37 $sequence++;
38 }
39}
40
41echo pht('Done.')."\n";