mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 16:16:14 +01:00
d6b882a804
Summary: Ref T6822. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: hach-que, Korvin, epriestley Maniphest Tasks: T6822 Differential Revision: https://secure.phabricator.com/D11370
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Denormalizes object names to support queries which need to be ordered or
|
|
* grouped by things like projects.
|
|
*/
|
|
final class ManiphestNameIndex extends ManiphestDAO {
|
|
|
|
protected $indexedObjectPHID;
|
|
protected $indexedObjectName;
|
|
|
|
protected function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_TIMESTAMPS => false,
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'indexedObjectName' => 'sort128',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'key_phid' => array(
|
|
'columns' => array('indexedObjectPHID'),
|
|
'unique' => true,
|
|
),
|
|
'key_name' => array(
|
|
'columns' => array('indexedObjectName'),
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public static function updateIndex($phid, $name) {
|
|
$table = new ManiphestNameIndex();
|
|
$conn_w = $table->establishConnection('w');
|
|
queryfx(
|
|
$conn_w,
|
|
'INSERT INTO %T (indexedObjectPHID, indexedObjectName) VALUES (%s, %s)
|
|
ON DUPLICATE KEY UPDATE indexedObjectName = VALUES(indexedObjectName)',
|
|
$table->getTableName(),
|
|
$phid,
|
|
$name);
|
|
}
|
|
|
|
}
|