1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Provide generalized custom field storage and custom field indexes in Maniphest

Summary: Ref T418. Depends on D6992. This adds index and value storage for Maniphest custom fields.

Test Plan: Ran storage upgrade.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T418

Differential Revision: https://secure.phabricator.com/D6995
This commit is contained in:
epriestley 2013-09-16 14:06:41 -07:00
parent c8574cf6fd
commit b0e145f2fe
7 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,29 @@
CREATE TABLE {$NAMESPACE}_maniphest.maniphest_customfieldstorage (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
fieldIndex CHAR(12) NOT NULL COLLATE utf8_bin,
fieldValue LONGTEXT NOT NULL,
UNIQUE KEY (objectPHID, fieldIndex)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_maniphest.maniphest_customfieldstringindex (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
indexKey VARCHAR(12) NOT NULL COLLATE utf8_bin,
indexValue LONGTEXT NOT NULL COLLATE utf8_general_ci,
KEY `key_join` (objectPHID, indexKey, indexValue(64)),
KEY `key_find` (indexKey, indexValue(64))
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_maniphest.maniphest_customfieldnumericindex (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
indexKey VARCHAR(12) NOT NULL COLLATE utf8_bin,
indexValue BIGINT NOT NULL,
KEY `key_join` (objectPHID, indexKey, indexValue),
KEY `key_find` (indexKey, indexValue)
) ENGINE=InnoDB, COLLATE utf8_general_ci;

View file

@ -691,6 +691,9 @@ phutil_register_library_map(array(
'ManiphestController' => 'applications/maniphest/controller/ManiphestController.php',
'ManiphestCreateMailReceiver' => 'applications/maniphest/mail/ManiphestCreateMailReceiver.php',
'ManiphestCustomField' => 'applications/maniphest/field/ManiphestCustomField.php',
'ManiphestCustomFieldNumericIndex' => 'applications/maniphest/storage/ManiphestCustomFieldNumericIndex.php',
'ManiphestCustomFieldStorage' => 'applications/maniphest/storage/ManiphestCustomFieldStorage.php',
'ManiphestCustomFieldStringIndex' => 'applications/maniphest/storage/ManiphestCustomFieldStringIndex.php',
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
'ManiphestDefaultTaskExtensions' => 'applications/maniphest/extensions/ManiphestDefaultTaskExtensions.php',
'ManiphestEdgeEventListener' => 'applications/maniphest/event/ManiphestEdgeEventListener.php',
@ -2755,6 +2758,9 @@ phutil_register_library_map(array(
'ManiphestController' => 'PhabricatorController',
'ManiphestCreateMailReceiver' => 'PhabricatorMailReceiver',
'ManiphestCustomField' => 'PhabricatorCustomField',
'ManiphestCustomFieldNumericIndex' => 'PhabricatorCustomFieldNumericIndexStorage',
'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'ManiphestDAO' => 'PhabricatorLiskDAO',
'ManiphestDefaultTaskExtensions' => 'ManiphestTaskExtensions',
'ManiphestEdgeEventListener' => 'PhutilEventListener',

View file

@ -3,4 +3,16 @@
abstract class ManiphestCustomField
extends PhabricatorCustomField {
public function newStorageObject() {
return new ManiphestCustomFieldStorage();
}
protected function newStringIndexStorage() {
return new ManiphestCustomFieldStringIndex();
}
protected function newNumericIndexStorage() {
return new ManiphestCustomFieldNumericIndex();
}
}

View file

@ -0,0 +1,11 @@
<?php
final class ManiphestCustomFieldNumericIndex
extends PhabricatorCustomFieldNumericIndexStorage {
public function getApplicationName() {
return 'maniphest';
}
}

View file

@ -0,0 +1,11 @@
<?php
final class ManiphestCustomFieldStorage
extends PhabricatorCustomFieldStorage {
public function getApplicationName() {
return 'maniphest';
}
}

View file

@ -0,0 +1,11 @@
<?php
final class ManiphestCustomFieldStringIndex
extends PhabricatorCustomFieldStringIndexStorage {
public function getApplicationName() {
return 'maniphest';
}
}

View file

@ -1596,6 +1596,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql',
'name' => $this->getPatchPath('20130914.usercustom.sql'),
),
'20130915.maniphestcustom.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130915.maniphestcustom.sql'),
),
);
}
}