diff --git a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php --- a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php @@ -154,7 +154,8 @@ // collation. This is most correct, and will sort properly. $utf8_charset = 'utf8mb4'; - $utf8_collation = 'utf8mb4_unicode_ci'; + $utf8_binary_collation = 'utf8mb4_bin'; + $utf8_sorting_collation = 'utf8mb4_unicode_ci'; } else { // If utf8mb4 is not available, we use binary. This allows us to store // 4-byte unicode characters. This has some tradeoffs: @@ -167,7 +168,8 @@ // to prevent this. $utf8_charset = 'binary'; - $utf8_collation = 'binary'; + $utf8_binary_collation = 'binary'; + $utf8_sorting_collation = 'binary'; } $specs = id(new PhutilSymbolLoader()) @@ -177,8 +179,9 @@ $server_schema = new PhabricatorConfigServerSchema(); foreach ($specs as $spec) { $spec - ->setUTF8Collation($utf8_collation) ->setUTF8Charset($utf8_charset) + ->setUTF8BinaryCollation($utf8_binary_collation) + ->setUTF8SortingCollation($utf8_sorting_collation) ->setServer($server_schema) ->buildSchemata($server_schema); } diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php --- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php @@ -4,15 +4,25 @@ private $server; private $utf8Charset; - private $utf8Collation; + private $utf8BinaryCollation; + private $utf8SortingCollation; - public function setUTF8Collation($utf8_collation) { - $this->utf8Collation = $utf8_collation; + public function setUTF8SortingCollation($utf8_sorting_collation) { + $this->utf8SortingCollation = $utf8_sorting_collation; return $this; } - public function getUTF8Collation() { - return $this->utf8Collation; + public function getUTF8SortingCollation() { + return $this->utf8SortingCollation; + } + + public function setUTF8BinaryCollation($utf8_binary_collation) { + $this->utf8BinaryCollation = $utf8_binary_collation; + return $this; + } + + public function getUTF8BinaryCollation() { + return $this->utf8BinaryCollation; } public function setUTF8Charset($utf8_charset) { @@ -195,7 +205,7 @@ return id(new PhabricatorConfigDatabaseSchema()) ->setName($this->getNamespacedDatabase($name)) ->setCharacterSet($this->getUTF8Charset()) - ->setCollation($this->getUTF8Collation()); + ->setCollation($this->getUTF8BinaryCollation()); } protected function getNamespacedDatabase($name) { @@ -206,7 +216,7 @@ protected function newTable($name) { return id(new PhabricatorConfigTableSchema()) ->setName($name) - ->setCollation($this->getUTF8Collation()); + ->setCollation($this->getUTF8BinaryCollation()); } protected function newColumn($name) { @@ -276,70 +286,95 @@ case 'bytes': $column_type = 'longblob'; break; + case 'sort255': + $column_type = 'varchar(255)'; + $charset = $this->getUTF8Charset(); + $collation = $this->getUTF8SortingCollation(); + break; + case 'sort128': + $column_type = 'varchar(128)'; + $charset = $this->getUTF8Charset(); + $collation = $this->getUTF8SortingCollation(); + break; + case 'sort64': + $column_type = 'varchar(64)'; + $charset = $this->getUTF8Charset(); + $collation = $this->getUTF8SortingCollation(); + break; + case 'sort32': + $column_type = 'varchar(32)'; + $charset = $this->getUTF8Charset(); + $collation = $this->getUTF8SortingCollation(); + break; + case 'sort': + $column_type = 'longtext'; + $charset = $this->getUTF8Charset(); + $collation = $this->getUTF8SortingCollation(); + break; case 'text255': $column_type = 'varchar(255)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text160': $column_type = 'varchar(160)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text128': $column_type = 'varchar(128)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text80': $column_type = 'varchar(80)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text64': $column_type = 'varchar(64)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text40': $column_type = 'varchar(40)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text32': $column_type = 'varchar(32)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text20': $column_type = 'varchar(20)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text16': $column_type = 'varchar(16)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text12': $column_type = 'varchar(12)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text8': $column_type = 'varchar(8)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text4': $column_type = 'varchar(4)'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'text': $column_type = 'longtext'; $charset = $this->getUTF8Charset(); - $collation = $this->getUTF8Collation(); + $collation = $this->getUTF8BinaryCollation(); break; case 'bool': $column_type = 'tinyint(1)'; diff --git a/src/applications/maniphest/storage/ManiphestNameIndex.php b/src/applications/maniphest/storage/ManiphestNameIndex.php --- a/src/applications/maniphest/storage/ManiphestNameIndex.php +++ b/src/applications/maniphest/storage/ManiphestNameIndex.php @@ -13,7 +13,7 @@ return array( self::CONFIG_TIMESTAMPS => false, self::CONFIG_COLUMN_SCHEMA => array( - 'indexedObjectName' => 'text128', + 'indexedObjectName' => 'sort128', ), self::CONFIG_KEY_SCHEMA => array( 'key_phid' => array( diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -71,7 +71,7 @@ 'ownerPHID' => 'phid?', 'status' => 'text12', 'priority' => 'uint32', - 'title' => 'text', + 'title' => 'sort', 'originalTitle' => 'text', 'description' => 'text', 'mailKey' => 'bytes20', @@ -114,6 +114,9 @@ 'key_dateModified' => array( 'columns' => array('dateModified'), ), + 'key_title' => array( + 'columns' => array('title(64)'), + ), ), ) + parent::getConfiguration(); } diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -90,7 +90,7 @@ ), self::CONFIG_COLUMN_SCHEMA => array( 'title' => 'text255', - 'phameTitle' => 'text64', + 'phameTitle' => 'sort64', 'visibility' => 'uint32', // T6203/NULLABILITY diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php --- a/src/applications/phriction/storage/PhrictionContent.php +++ b/src/applications/phriction/storage/PhrictionContent.php @@ -32,7 +32,7 @@ return array( self::CONFIG_COLUMN_SCHEMA => array( 'version' => 'uint32', - 'title' => 'text', + 'title' => 'sort', 'slug' => 'text128', 'content' => 'text', 'changeType' => 'uint32', diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -25,7 +25,7 @@ self::CONFIG_AUX_PHID => true, self::CONFIG_TIMESTAMPS => false, self::CONFIG_COLUMN_SCHEMA => array( - 'slug' => 'text128', + 'slug' => 'sort128', 'depth' => 'uint32', 'contentID' => 'id?', 'status' => 'uint32', diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -122,7 +122,7 @@ 'subprojectPHIDs' => self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'name' => 'text128', + 'name' => 'sort128', 'status' => 'text32', 'phrictionSlug' => 'text128?', 'isMembershipLocked' => 'bool', diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -79,8 +79,8 @@ 'details' => self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'name' => 'text255', - 'callsign' => 'text32', + 'name' => 'sort255', + 'callsign' => 'sort32', 'versionControlSystem' => 'text32', 'uuid' => 'text64?', 'pushPolicy' => 'policy', diff --git a/src/infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php b/src/infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php --- a/src/infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php +++ b/src/infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php @@ -7,7 +7,7 @@ return array( self::CONFIG_COLUMN_SCHEMA => array( 'indexKey' => 'bytes12', - 'indexValue' => 'text', + 'indexValue' => 'sort', ), self::CONFIG_KEY_SCHEMA => array( 'key_join' => array(