From cf1c06e157b60b87e25146c8748a92a1f107ba33 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 21 Oct 2013 17:01:13 -0700 Subject: [PATCH] Add custom field storage to Projects Summary: Ref T4010. Adds storage and indexes for custom fields. These tables are the same as people/maniphest/differential. Test Plan: Ran `bin/storage upgrade`. Reviewers: chad, btrahan Reviewed By: chad CC: aran Maniphest Tasks: T4010 Differential Revision: https://secure.phabricator.com/D7369 --- resources/sql/patches/20131020.pcustom.sql | 29 +++++++++++++++++++ ...bricatorProjectCustomFieldNumericIndex.php | 11 +++++++ .../PhabricatorProjectCustomFieldStorage.php | 11 +++++++ ...abricatorProjectCustomFieldStringIndex.php | 11 +++++++ .../patch/PhabricatorBuiltinPatchList.php | 4 +++ 5 files changed, 66 insertions(+) create mode 100644 resources/sql/patches/20131020.pcustom.sql create mode 100644 src/applications/project/storage/PhabricatorProjectCustomFieldNumericIndex.php create mode 100644 src/applications/project/storage/PhabricatorProjectCustomFieldStorage.php create mode 100644 src/applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php diff --git a/resources/sql/patches/20131020.pcustom.sql b/resources/sql/patches/20131020.pcustom.sql new file mode 100644 index 0000000000..cf8efab13d --- /dev/null +++ b/resources/sql/patches/20131020.pcustom.sql @@ -0,0 +1,29 @@ +CREATE TABLE {$NAMESPACE}_project.project_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}_project.project_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}_project.project_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/applications/project/storage/PhabricatorProjectCustomFieldNumericIndex.php b/src/applications/project/storage/PhabricatorProjectCustomFieldNumericIndex.php new file mode 100644 index 0000000000..095155a0b4 --- /dev/null +++ b/src/applications/project/storage/PhabricatorProjectCustomFieldNumericIndex.php @@ -0,0 +1,11 @@ + 'php', 'name' => $this->getPatchPath('20130926.dinline.php'), ), + '20131020.pcustom.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20131020.pcustom.sql'), + ), ); } } -- 2.51.2