diff --git a/resources/sql/patches/20130915.maniphestcustom.sql b/resources/sql/patches/20130915.maniphestcustom.sql new file mode 100644 index 0000000000..6b2cd2674a --- /dev/null +++ b/resources/sql/patches/20130915.maniphestcustom.sql @@ -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; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index e54a375b71..f9dc3ae204 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/maniphest/field/ManiphestCustomField.php b/src/applications/maniphest/field/ManiphestCustomField.php index 5c70b95e82..26c18cbb8c 100644 --- a/src/applications/maniphest/field/ManiphestCustomField.php +++ b/src/applications/maniphest/field/ManiphestCustomField.php @@ -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(); + } + } diff --git a/src/applications/maniphest/storage/ManiphestCustomFieldNumericIndex.php b/src/applications/maniphest/storage/ManiphestCustomFieldNumericIndex.php new file mode 100644 index 0000000000..640552c63c --- /dev/null +++ b/src/applications/maniphest/storage/ManiphestCustomFieldNumericIndex.php @@ -0,0 +1,11 @@ + 'sql', 'name' => $this->getPatchPath('20130914.usercustom.sql'), ), + '20130915.maniphestcustom.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20130915.maniphestcustom.sql'), + ), ); } }