1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

Add "subtype" storage to Maniphest tasks

Summary: Ref T12314. Provides a field on tasks for storing subtypes. Does nothing interesting yet.

Test Plan:
  - Ran storage upgrade.
  - Created some tasks.
  - Looked in the database.
  - Used Conduit to query some tasks.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12314

Differential Revision: https://secure.phabricator.com/D17441
This commit is contained in:
epriestley 2017-03-01 15:37:26 -08:00
parent 1b96f2fc28
commit dc7ecf5875
6 changed files with 52 additions and 1 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
ADD subtype VARCHAR(64) COLLATE {$COLLATE_TEXT} NOT NULL;

View file

@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_maniphest.maniphest_task
SET subtype = 'default' WHERE subtype = '';

View file

@ -2626,6 +2626,7 @@ phutil_register_library_map(array(
'PhabricatorEditEngineSettingsPanel' => 'applications/settings/panel/PhabricatorEditEngineSettingsPanel.php', 'PhabricatorEditEngineSettingsPanel' => 'applications/settings/panel/PhabricatorEditEngineSettingsPanel.php',
'PhabricatorEditEngineStaticCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineStaticCommentAction.php', 'PhabricatorEditEngineStaticCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineStaticCommentAction.php',
'PhabricatorEditEngineSubtype' => 'applications/transactions/editengine/PhabricatorEditEngineSubtype.php', 'PhabricatorEditEngineSubtype' => 'applications/transactions/editengine/PhabricatorEditEngineSubtype.php',
'PhabricatorEditEngineSubtypeInterface' => 'applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php',
'PhabricatorEditEngineSubtypeTestCase' => 'applications/transactions/editengine/__tests__/PhabricatorEditEngineSubtypeTestCase.php', 'PhabricatorEditEngineSubtypeTestCase' => 'applications/transactions/editengine/__tests__/PhabricatorEditEngineSubtypeTestCase.php',
'PhabricatorEditEngineTokenizerCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineTokenizerCommentAction.php', 'PhabricatorEditEngineTokenizerCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineTokenizerCommentAction.php',
'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php', 'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php',
@ -6367,6 +6368,7 @@ phutil_register_library_map(array(
'PhabricatorConduitResultInterface', 'PhabricatorConduitResultInterface',
'PhabricatorFulltextInterface', 'PhabricatorFulltextInterface',
'DoorkeeperBridgedObjectInterface', 'DoorkeeperBridgedObjectInterface',
'PhabricatorEditEngineSubtypeInterface',
), ),
'ManiphestTaskAssignHeraldAction' => 'HeraldAction', 'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction', 'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',

View file

@ -24,6 +24,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
private $hasOpenSubtasks; private $hasOpenSubtasks;
private $parentTaskIDs; private $parentTaskIDs;
private $subtaskIDs; private $subtaskIDs;
private $subtypes;
private $fullTextSearch = ''; private $fullTextSearch = '';
@ -208,6 +209,11 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
return $this; return $this;
} }
public function withSubtypes(array $subtypes) {
$this->subtypes = $subtypes;
return $this;
}
public function newResultObject() { public function newResultObject() {
return new ManiphestTask(); return new ManiphestTask();
} }
@ -423,6 +429,13 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
$this->bridgedObjectPHIDs); $this->bridgedObjectPHIDs);
} }
if ($this->subtypes !== null) {
$where[] = qsprintf(
$conn,
'task.subtype IN (%Ls)',
$this->subtypes);
}
return $where; return $where;
} }

View file

@ -16,7 +16,8 @@ final class ManiphestTask extends ManiphestDAO
PhabricatorSpacesInterface, PhabricatorSpacesInterface,
PhabricatorConduitResultInterface, PhabricatorConduitResultInterface,
PhabricatorFulltextInterface, PhabricatorFulltextInterface,
DoorkeeperBridgedObjectInterface { DoorkeeperBridgedObjectInterface,
PhabricatorEditEngineSubtypeInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@ -40,6 +41,7 @@ final class ManiphestTask extends ManiphestDAO
protected $bridgedObjectPHID; protected $bridgedObjectPHID;
protected $properties = array(); protected $properties = array();
protected $points; protected $points;
protected $subtype;
private $subscriberPHIDs = self::ATTACHABLE; private $subscriberPHIDs = self::ATTACHABLE;
private $groupByProjectPHID = self::ATTACHABLE; private $groupByProjectPHID = self::ATTACHABLE;
@ -63,6 +65,7 @@ final class ManiphestTask extends ManiphestDAO
->setViewPolicy($view_policy) ->setViewPolicy($view_policy)
->setEditPolicy($edit_policy) ->setEditPolicy($edit_policy)
->setSpacePHID($actor->getDefaultSpacePHID()) ->setSpacePHID($actor->getDefaultSpacePHID())
->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT)
->attachProjectPHIDs(array()) ->attachProjectPHIDs(array())
->attachSubscriberPHIDs(array()); ->attachSubscriberPHIDs(array());
} }
@ -86,6 +89,7 @@ final class ManiphestTask extends ManiphestDAO
'subpriority' => 'double', 'subpriority' => 'double',
'points' => 'double?', 'points' => 'double?',
'bridgedObjectPHID' => 'phid?', 'bridgedObjectPHID' => 'phid?',
'subtype' => 'text64',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null, 'key_phid' => null,
@ -124,6 +128,9 @@ final class ManiphestTask extends ManiphestDAO
'columns' => array('bridgedObjectPHID'), 'columns' => array('bridgedObjectPHID'),
'unique' => true, 'unique' => true,
), ),
'key_subtype' => array(
'columns' => array('subtype'),
),
), ),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }
@ -474,6 +481,10 @@ final class ManiphestTask extends ManiphestDAO
->setKey('points') ->setKey('points')
->setType('points') ->setType('points')
->setDescription(pht('Point value of the task.')), ->setDescription(pht('Point value of the task.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('subtype')
->setType('string')
->setDescription(pht('Subtype of the task.')),
); );
} }
@ -501,6 +512,7 @@ final class ManiphestTask extends ManiphestDAO
'status' => $status_info, 'status' => $status_info,
'priority' => $priority_info, 'priority' => $priority_info,
'points' => $this->getPoints(), 'points' => $this->getPoints(),
'subtype' => $this->getSubtype(),
); );
} }
@ -533,4 +545,16 @@ final class ManiphestTask extends ManiphestDAO
return $this; return $this;
} }
/* -( PhabricatorEditEngineSubtypeInterface )------------------------------ */
public function getEditEngineSubtype() {
return $this->getSubtype();
}
public function setEditEngineSubtype($value) {
return $this->setSubtype($value);
}
} }

View file

@ -0,0 +1,8 @@
<?php
interface PhabricatorEditEngineSubtypeInterface {
public function getEditEngineSubtype();
public function setEditEngineSubtype($subtype);
}