Skip to content
Snippets Groups Projects
Commit 318b6278 authored by efalcy's avatar efalcy
Browse files

dev #32668: add index on custom field value

parent 48327d0d
Branches
Tags
8 merge requests!1587Master,!1553Master,!1539Master,!1534Dev#32668 bib form custom fields refacto master,!1532Dev#37314 bibliotheque mode d affichage un champ saisi un bloc a styliser dans la charte,!1507Form custom fields refacto,!1488Dev#37314 bibliotheque mode d affichage un champ saisi un bloc a styliser dans la charte,!1475Dev#32668 bib form custom fields
<?php
error_reporting(E_ERROR | E_PARSE);
define("PATCH_LEVEL","286");
define("PATCH_LEVEL","287");
define("APPLI","cosmogramme");
define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs");
......
<?php
$adapter = Zend_Db_Table::getDefaultAdapter();
try {
$adapter->query(' alter table custom_field_values add index (value(50))');
} catch(Exception $e) {}
?>
<?php
$adapter = Zend_Db_Table::getDefaultAdapter();
try {
$adapter->query('alter table custom_field_values add index (value(50));');
} catch(Exception $e) {}
?>
......@@ -443,4 +443,22 @@ class UpgradeDB_286_Test extends UpgradeDBTestCase {
public function typeDocShouldExist() {
$this->assertColumn('notices_avis', 'type_doc');
}
}
class UpgradeDB_287_Test extends UpgradeDBTestCase {
public function prepare() {
try {
$this->query(' drop index value on custom_field_values');
} catch(Exception $e) {}
}
/** @test */
public function indexOnCustomFieldShouldExist() {
$this->assertNotNull($this->query("SELECT INDEX_NAME FROM INFORMATION_SCHEMA.STATISTICS WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'custom_field_values' AND `INDEX_NAME` ='value';"));
}
}
\ No newline at end of file
......@@ -248,6 +248,14 @@ class ArticleLoaderGetArticlesByPreferencesTest extends ModelTestCase {
/** @test */
function withArticleAndCustomFieldValueSelectionSqlShouldFilterByCustomField() {
$this->fixture('Class_CustomField',
['id' => 5,
'priority' => 3,
'label' => 'Options',
'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX,
'options_list' => 'wifi;jardinage;projection',
'model' => 'Article']);
$articles = $this->getArticles(array('display_order' => 'EventDebut',
'custom_fields' => [5 => 'value1',
12 => 'value2'],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment