@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 PhabricatorOwnersPackageTransaction();
4$conn = $table->establishConnection('w');
5$iterator = new LiskRawMigrationIterator($conn, $table->getTableName());
6
7// Migrate "Auditing State" transactions for Owners Packages from old values
8// (which were "0" or "1", as JSON integer literals, without quotes) to new
9// values (which are JSON strings, with quotes).
10
11foreach ($iterator as $row) {
12 if ($row['transactionType'] !== 'owners.auditing') {
13 continue;
14 }
15
16 $old_value = (int)$row['oldValue'];
17 $new_value = (int)$row['newValue'];
18
19 if (!$old_value) {
20 $old_value = 'none';
21 } else {
22 $old_value = 'audit';
23 }
24
25 if (!$new_value) {
26 $new_value = 'none';
27 } else {
28 $new_value = 'audit';
29 }
30
31 $old_value = phutil_json_encode($old_value);
32 $new_value = phutil_json_encode($new_value);
33
34 queryfx(
35 $conn,
36 'UPDATE %R SET oldValue = %s, newValue = %s WHERE id = %d',
37 $table,
38 $old_value,
39 $new_value,
40 $row['id']);
41}