Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/maniphest/storage/ManiphestNameIndex.php
12256 views
1
<?php
2
3
/**
4
* Denormalizes object names to support queries which need to be ordered or
5
* grouped by things like projects.
6
*/
7
final class ManiphestNameIndex extends ManiphestDAO {
8
9
protected $indexedObjectPHID;
10
protected $indexedObjectName;
11
12
protected function getConfiguration() {
13
return array(
14
self::CONFIG_TIMESTAMPS => false,
15
self::CONFIG_COLUMN_SCHEMA => array(
16
'indexedObjectName' => 'sort128',
17
),
18
self::CONFIG_KEY_SCHEMA => array(
19
'key_phid' => array(
20
'columns' => array('indexedObjectPHID'),
21
'unique' => true,
22
),
23
'key_name' => array(
24
'columns' => array('indexedObjectName'),
25
),
26
),
27
) + parent::getConfiguration();
28
}
29
30
public static function updateIndex($phid, $name) {
31
$table = new ManiphestNameIndex();
32
$conn_w = $table->establishConnection('w');
33
queryfx(
34
$conn_w,
35
'INSERT INTO %T (indexedObjectPHID, indexedObjectName) VALUES (%s, %s)
36
ON DUPLICATE KEY UPDATE indexedObjectName = VALUES(indexedObjectName)',
37
$table->getTableName(),
38
$phid,
39
$name);
40
}
41
42
}
43
44