mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
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
This commit is contained in:
parent
fc6bfbdb10
commit
c67e87c809
1 changed files with 38 additions and 0 deletions
38
resources/sql/autopatches/20161213.diff.01.hunks.php
Normal file
38
resources/sql/autopatches/20161213.diff.01.hunks.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
$conn = id(new DifferentialRevision())->establishConnection('w');
|
||||
$src_table = 'differential_hunk';
|
||||
$dst_table = 'differential_hunk_modern';
|
||||
|
||||
echo tsprintf(
|
||||
"%s\n",
|
||||
pht('Migrating old hunks...'));
|
||||
|
||||
foreach (new LiskRawMigrationIterator($conn, $src_table) as $row) {
|
||||
queryfx(
|
||||
$conn,
|
||||
'INSERT INTO %T
|
||||
(changesetID, oldOffset, oldLen, newOffset, newLen,
|
||||
dataType, dataEncoding, dataFormat, data,
|
||||
dateCreated, dateModified)
|
||||
VALUES
|
||||
(%d, %d, %d, %d, %d,
|
||||
%s, %s, %s, %s,
|
||||
%d, %d)',
|
||||
$dst_table,
|
||||
$row['changesetID'],
|
||||
$row['oldOffset'],
|
||||
$row['oldLen'],
|
||||
$row['newOffset'],
|
||||
$row['newLen'],
|
||||
DifferentialModernHunk::DATATYPE_TEXT,
|
||||
'utf8',
|
||||
DifferentialModernHunk::DATAFORMAT_RAW,
|
||||
$row['changes'],
|
||||
$row['dateCreated'],
|
||||
$row['dateModified']);
|
||||
}
|
||||
|
||||
echo tsprintf(
|
||||
"%s\n",
|
||||
pht('Done.'));
|
Loading…
Reference in a new issue