1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 19:32:40 +01:00
phorge-phorge/resources/sql/autopatches/20210215.changeset.02.phid-populate.php

27 lines
573 B
PHP
Raw Normal View History

<?php
$phid_type = DifferentialChangesetPHIDType::TYPECONST;
$changeset_table = new DifferentialChangeset();
$conn = $changeset_table->establishConnection('w');
$table_name = $changeset_table->getTableName();
$iterator = new LiskRawMigrationIterator($conn, $table_name);
foreach ($iterator as $changeset_row) {
$phid = $changeset_row['phid'];
if (strlen($phid)) {
continue;
}
$phid = PhabricatorPHID::generateNewPHID($phid_type);
queryfx(
$conn,
'UPDATE %T SET phid = %s WHERE id = %d',
$table_name,
$phid,
$changeset_row['id']);
}