Bug 5087: (QA follow-up) used_for deserves an index
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 20 Jul 2020 14:27:27 +0000 (11:27 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 23 Jul 2020 08:52:10 +0000 (10:52 +0200)
This patch introduces an index for the used_for column

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

installer/data/mysql/atomicupdate/bug_5087_-_add_opac_option_field_to_export_formats.perl
installer/data/mysql/kohastructure.sql

index 7eaffd4..41ee945 100644 (file)
@@ -8,5 +8,12 @@ if( CheckVersion( $DBversion ) ) {
         |);
     }
 
+    unless ( index_exists( 'export_format', 'used_for_idx' ) ) {
+        $dbh->do(q|
+            ALTER TABLE export_format
+                ADD KEY `used_for_idx` (`used_for` (191));
+        |);
+    }
+
     NewVersion( $DBversion, 5087, "Add export_format.staff_only" );
 }
index 456f7b1..49cdb3b 100644 (file)
@@ -693,6 +693,7 @@ CREATE TABLE `export_format` (
   `used_for` varchar(255) DEFAULT 'export_records',
   `staff_only` TINYINT(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`export_format_id`),
+  KEY `used_for_idx` (`used_for` (191)),
   KEY `staff_only_idx` (`staff_only`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';