1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 21:10:56 +01:00

Remove three ancient columns from Maniphest tasks: attached, projectPHIDs, ccPHIDs

Summary:
Before edges, we stored some of this stuff directly on tasks.

  - `attached` was migrated to edges in Jan 2013.
  - `projectPHIDs` was never used, as far as I can tell?
  - `ccPHIDs` was migrated away and dropped more than a year ago.

None of these columns are used in modern code (instead, modern code uses edges).

Test Plan: `grep`, browsed around, `bin/storage upgrade`, unit tests.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15216
This commit is contained in:
epriestley 2016-02-08 12:17:16 -08:00
parent 3682cc9bb2
commit 32225d1dd0
5 changed files with 6 additions and 70 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
DROP projectPHIDs;

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
DROP attached;

View file

@ -1,29 +1,3 @@
<?php <?php
echo pht('Migrating task dependencies to edges...')."\n"; // From 2013-2016, this migration moved dependent tasks to edges.
$table = new ManiphestTask();
$table->openTransaction();
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
echo pht('Task %d: ', $id);
$deps = $task->getAttachedPHIDs(ManiphestTaskPHIDType::TYPECONST);
if (!$deps) {
echo "-\n";
continue;
}
$editor = new PhabricatorEdgeEditor();
foreach ($deps as $dep) {
$editor->addEdge(
$task->getPHID(),
ManiphestTaskDependsOnTaskEdgeType::EDGECONST,
$dep);
}
$editor->save();
echo pht('OKAY')."\n";
}
$table->saveTransaction();
echo pht('Done.')."\n";

View file

@ -1,28 +1,3 @@
<?php <?php
echo pht('Migrating task revisions to edges...')."\n"; // From 2013-2016, this migration moved revisions attached to tasks to edges.
$table = new ManiphestTask();
$table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
echo pht('Task %d: ', $id);
$revs = $task->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST);
if (!$revs) {
echo "-\n";
continue;
}
$editor = new PhabricatorEdgeEditor();
foreach ($revs as $rev) {
$editor->addEdge(
$task->getPHID(),
ManiphestTaskHasRevisionEdgeType::EDGECONST,
$rev);
}
$editor->save();
echo pht('OKAY')."\n";
}
echo pht('Done.')."\n";

View file

@ -34,8 +34,6 @@ final class ManiphestTask extends ManiphestDAO
protected $viewPolicy = PhabricatorPolicies::POLICY_USER; protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER; protected $editPolicy = PhabricatorPolicies::POLICY_USER;
protected $projectPHIDs = array();
protected $ownerOrdering; protected $ownerOrdering;
protected $spacePHID; protected $spacePHID;
protected $properties = array(); protected $properties = array();
@ -45,9 +43,6 @@ final class ManiphestTask extends ManiphestDAO
private $customFields = self::ATTACHABLE; private $customFields = self::ATTACHABLE;
private $edgeProjectPHIDs = self::ATTACHABLE; private $edgeProjectPHIDs = self::ATTACHABLE;
// TODO: This field is unused and should eventually be removed.
protected $attached = array();
public static function initializeNewTask(PhabricatorUser $actor) { public static function initializeNewTask(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
->setViewer($actor) ->setViewer($actor)
@ -72,9 +67,6 @@ final class ManiphestTask extends ManiphestDAO
return array( return array(
self::CONFIG_AUX_PHID => true, self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'ccPHIDs' => self::SERIALIZATION_JSON,
'attached' => self::SERIALIZATION_JSON,
'projectPHIDs' => self::SERIALIZATION_JSON,
'properties' => self::SERIALIZATION_JSON, 'properties' => self::SERIALIZATION_JSON,
), ),
self::CONFIG_COLUMN_SCHEMA => array( self::CONFIG_COLUMN_SCHEMA => array(
@ -88,11 +80,6 @@ final class ManiphestTask extends ManiphestDAO
'ownerOrdering' => 'text64?', 'ownerOrdering' => 'text64?',
'originalEmailSource' => 'text255?', 'originalEmailSource' => 'text255?',
'subpriority' => 'double', 'subpriority' => 'double',
// T6203/NULLABILITY
// This should not be nullable. It's going away soon anyway.
'ccPHIDs' => 'text?',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null, 'key_phid' => null,
@ -143,10 +130,6 @@ final class ManiphestTask extends ManiphestDAO
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST); ManiphestTaskDependedOnByTaskEdgeType::EDGECONST);
} }
public function getAttachedPHIDs($type) {
return array_keys(idx($this->attached, $type, array()));
}
public function generatePHID() { public function generatePHID() {
return PhabricatorPHID::generateNewPHID(ManiphestTaskPHIDType::TYPECONST); return PhabricatorPHID::generateNewPHID(ManiphestTaskPHIDType::TYPECONST);
} }