2013-11-06 22:59:06 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$diff_table = new DifferentialDiff();
|
|
|
|
$conn_w = $diff_table->establishConnection('w');
|
|
|
|
|
|
|
|
$size = 1000;
|
|
|
|
|
|
|
|
$row_iter = id(new LiskMigrationIterator($diff_table))->setPageSize($size);
|
|
|
|
$chunk_iter = new PhutilChunkedIterator($row_iter, $size);
|
|
|
|
|
|
|
|
foreach ($chunk_iter as $chunk) {
|
|
|
|
$sql = array();
|
|
|
|
|
|
|
|
foreach ($chunk as $diff) {
|
|
|
|
$id = $diff->getID();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating diff ID %d...', $id)."\n";
|
2013-11-06 22:59:06 +01:00
|
|
|
|
|
|
|
$phid = $diff->getPHID();
|
|
|
|
if (strlen($phid)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-07-24 00:05:46 +02:00
|
|
|
$type_diff = DifferentialDiffPHIDType::TYPECONST;
|
2013-11-06 22:59:06 +01:00
|
|
|
$new_phid = PhabricatorPHID::generateNewPHID($type_diff);
|
|
|
|
|
|
|
|
$sql[] = qsprintf(
|
|
|
|
$conn_w,
|
|
|
|
'(%d, %s)',
|
|
|
|
$id,
|
|
|
|
$new_phid);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$sql) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-11-07 01:57:55 +01:00
|
|
|
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $sql_chunk) {
|
2013-11-06 22:59:06 +01:00
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
2018-11-07 01:57:55 +01:00
|
|
|
'INSERT IGNORE INTO %T (id, phid) VALUES %LQ
|
2013-11-06 22:59:06 +01:00
|
|
|
ON DUPLICATE KEY UPDATE phid = VALUES(phid)',
|
|
|
|
$diff_table->getTableName(),
|
|
|
|
$sql_chunk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|