Move board relationships to dedicated storage

Summary:
Fixes T5476. Using edges to store which objects are on which board columns ends up being pretty awkward. In particular, it makes T4807 very difficult to implement.

Introduce a dedicated `BoardColumnPosition` storage.

This doesn't affect ordering rules (T4807) yet: boards are still arranged by priority. We just read which tasks are on which columns out of a new table.

Test Plan:
  - Migrated data, then viewed some boards. Saw exactly the same data.
  - Dragged tasks from column to column.
  - Created a task directly into a column.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5476

Differential Revision: https://secure.phabricator.com/D10160
This commit is contained in:
epriestley
2014-08-06 15:09:09 -07:00
parent 95ef72e4f9
commit 09868271bd
11 changed files with 472 additions and 124 deletions

View File

@@ -57,27 +57,26 @@ final class PhabricatorProjectMoveController
return new Aphront404Response();
}
$positions = id(new PhabricatorProjectColumnPositionQuery())
->setViewer($viewer)
->withColumns($columns)
->withObjectPHIDs(array($object_phid))
->execute();
$xactions = array();
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN;
$query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($object->getPHID()))
->withEdgeTypes(array($edge_type))
->withDestinationPHIDs(array_keys($columns));
$query->execute();
$edge_phids = $query->getDestinationPHIDs();
$xactions[] = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransaction::TYPE_PROJECT_COLUMN)
->setNewValue(array(
'columnPHIDs' => array($column->getPHID()),
'projectPHID' => $column->getProjectPHID()))
->setOldValue(array(
'columnPHIDs' => $edge_phids,
'projectPHID' => $column->getProjectPHID()));
->setNewValue(
array(
'columnPHIDs' => array($column->getPHID()),
'projectPHID' => $column->getProjectPHID(),
))
->setOldValue(
array(
'columnPHIDs' => mpull($positions, 'getColumnPHID'),
'projectPHID' => $column->getProjectPHID(),
));
$task_phids = array();
if ($after_phid) {
@@ -86,6 +85,7 @@ final class PhabricatorProjectMoveController
if ($before_phid) {
$task_phids[] = $before_phid;
}
if ($task_phids) {
$tasks = id(new ManiphestTaskQuery())
->setViewer($viewer)