@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$conn = id(new DifferentialRevision())->establishConnection('w');
4$src_table = 'differential_hunk';
5$dst_table = 'differential_hunk_modern';
6
7echo tsprintf(
8 "%s\n",
9 pht('Migrating old hunks...'));
10
11foreach (new LiskRawMigrationIterator($conn, $src_table) as $row) {
12 queryfx(
13 $conn,
14 'INSERT INTO %T
15 (changesetID, oldOffset, oldLen, newOffset, newLen,
16 dataType, dataEncoding, dataFormat, data,
17 dateCreated, dateModified)
18 VALUES
19 (%d, %d, %d, %d, %d,
20 %s, %s, %s, %s,
21 %d, %d)',
22 $dst_table,
23 $row['changesetID'],
24 $row['oldOffset'],
25 $row['oldLen'],
26 $row['newOffset'],
27 $row['newLen'],
28 DifferentialHunk::DATATYPE_TEXT,
29 'utf8',
30 DifferentialHunk::DATAFORMAT_RAW,
31 // In rare cases, this could be NULL. See T12090.
32 (string)$row['changes'],
33 $row['dateCreated'],
34 $row['dateModified']);
35}
36
37echo tsprintf(
38 "%s\n",
39 pht('Done.'));