1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +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',
'PhabricatorEditEngineStaticCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineStaticCommentAction.php',
'PhabricatorEditEngineSubtype' => 'applications/transactions/editengine/PhabricatorEditEngineSubtype.php',
'PhabricatorEditEngineSubtypeInterface' => 'applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php',
'PhabricatorEditEngineSubtypeTestCase' => 'applications/transactions/editengine/__tests__/PhabricatorEditEngineSubtypeTestCase.php',
'PhabricatorEditEngineTokenizerCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineTokenizerCommentAction.php',
'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php',
@ -6367,6 +6368,7 @@ phutil_register_library_map(array(
'PhabricatorConduitResultInterface',
'PhabricatorFulltextInterface',
'DoorkeeperBridgedObjectInterface',
'PhabricatorEditEngineSubtypeInterface',
),
'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',

View file

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

View file

@ -16,7 +16,8 @@ final class ManiphestTask extends ManiphestDAO
PhabricatorSpacesInterface,
PhabricatorConduitResultInterface,
PhabricatorFulltextInterface,
DoorkeeperBridgedObjectInterface {
DoorkeeperBridgedObjectInterface,
PhabricatorEditEngineSubtypeInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@ -40,6 +41,7 @@ final class ManiphestTask extends ManiphestDAO
protected $bridgedObjectPHID;
protected $properties = array();
protected $points;
protected $subtype;
private $subscriberPHIDs = self::ATTACHABLE;
private $groupByProjectPHID = self::ATTACHABLE;
@ -63,6 +65,7 @@ final class ManiphestTask extends ManiphestDAO
->setViewPolicy($view_policy)
->setEditPolicy($edit_policy)
->setSpacePHID($actor->getDefaultSpacePHID())
->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT)
->attachProjectPHIDs(array())
->attachSubscriberPHIDs(array());
}
@ -86,6 +89,7 @@ final class ManiphestTask extends ManiphestDAO
'subpriority' => 'double',
'points' => 'double?',
'bridgedObjectPHID' => 'phid?',
'subtype' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
@ -124,6 +128,9 @@ final class ManiphestTask extends ManiphestDAO
'columns' => array('bridgedObjectPHID'),
'unique' => true,
),
'key_subtype' => array(
'columns' => array('subtype'),
),
),
) + parent::getConfiguration();
}
@ -474,6 +481,10 @@ final class ManiphestTask extends ManiphestDAO
->setKey('points')
->setType('points')
->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,
'priority' => $priority_info,
'points' => $this->getPoints(),
'subtype' => $this->getSubtype(),
);
}
@ -533,4 +545,16 @@ final class ManiphestTask extends ManiphestDAO
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);
}