Skip to content

Commit c67e87c

Browse files
author
epriestley
committed
Force hunk storage migration to the modern format
Summary: Ref T8475. This forces installs to migrate hunks to the modern format. We stopped writing to the legacy format a very long time ago (2+ years?) without issues. This doesn't destroy any data. T8623 has guidance and I'll publish more changelog guidance. Test Plan: Faked some legacy data and migrated it. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8475 Differential Revision: https://secure.phabricator.com/D17039
1 parent fc6bfbd commit c67e87c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
$conn = id(new DifferentialRevision())->establishConnection('w');
4+
$src_table = 'differential_hunk';
5+
$dst_table = 'differential_hunk_modern';
6+
7+
echo tsprintf(
8+
"%s\n",
9+
pht('Migrating old hunks...'));
10+
11+
foreach (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+
DifferentialModernHunk::DATATYPE_TEXT,
29+
'utf8',
30+
DifferentialModernHunk::DATAFORMAT_RAW,
31+
$row['changes'],
32+
$row['dateCreated'],
33+
$row['dateModified']);
34+
}
35+
36+
echo tsprintf(
37+
"%s\n",
38+
pht('Done.'));

0 commit comments

Comments
 (0)