mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
d9db1d61e0
Summary: Ref T4110. This denormalized field used to power "Group By: Assigned" got dropped in the T2217 migration at some point. Restore its population, and fix all the data in the database. Test Plan: Ran migration, verified database came out reasonable-looking. Reassigned a task, verified database. Ran a "Group By: assigned" query. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4110 Differential Revision: https://secure.phabricator.com/D7602
38 lines
837 B
PHP
38 lines
837 B
PHP
<?php
|
|
|
|
$table = new ManiphestTask();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
foreach (new LiskMigrationIterator($table) as $task) {
|
|
$id = $task->getID();
|
|
|
|
echo "Checking task T{$id}...\n";
|
|
$owner_phid = $task->getOwnerPHID();
|
|
|
|
if (!$owner_phid && !$task->getOwnerOrdering()) {
|
|
// No owner and no ordering; we're all set.
|
|
continue;
|
|
}
|
|
|
|
$owner_handle = id(new PhabricatorHandleQuery())
|
|
->setViewer(PhabricatorUser::getOmnipotentUser())
|
|
->withPHIDs(array($owner_phid))
|
|
->executeOne();
|
|
|
|
if ($owner_handle) {
|
|
$value = $owner_handle->getName();
|
|
} else {
|
|
$value = null;
|
|
}
|
|
|
|
if ($value !== $task->getOwnerOrdering()) {
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET ownerOrdering = %ns WHERE id = %d',
|
|
$table->getTableName(),
|
|
$value,
|
|
$task->getID());
|
|
}
|
|
}
|
|
|
|
echo "Done.\n";
|