Skip to content

Commit

Permalink
Add better index for element texts
Browse files Browse the repository at this point in the history
Bump version to 3.2-dev to prompt upgrades
  • Loading branch information
zerocrates committed Jul 9, 2024
1 parent 5194bb3 commit 76bcf1c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
20 changes: 20 additions & 0 deletions application/migrations/20240709181800_addElementTextIndex.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Omeka
*
* @copyright Copyright 2007-2020 Roy Rosenzweig Center for History and New Media
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/

/**
* Add better index for sorting/filtering element texts by specific element
*
* @package Omeka\Db\Migration
*/
class addElementTextIndex extends Omeka_Db_Migration_AbstractMigration
{
public function up()
{
$this->db->query("ALTER TABLE {$this->db->ElementText} ADD INDEX `record_element_text` (`record_type`, `record_id`, `element_id`, `text`(20))");
}
}
3 changes: 2 additions & 1 deletion application/schema/element_texts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%element_texts` (
PRIMARY KEY (`id`),
KEY `record_type_record_id` (`record_type`, `record_id`),
KEY `element_id` (`element_id`),
KEY `text` (`text`(20))
KEY `text` (`text`(20)),
KEY `record_element_text` (`record_type`, `record_id`, `element_id`, `text`(20));
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Define the current version of Omeka.
define('OMEKA_VERSION', '3.1.2');
define('OMEKA_VERSION', '3.2-dev');

// Define the application environment.
if (!defined('APPLICATION_ENV')) {
Expand Down

0 comments on commit 76bcf1c

Please sign in to comment.