Make WordPress Core

Changeset 47193


Ignore:
Timestamp:
02/05/2020 06:19:11 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Tests: In Tests_dbDelta::setUp(), only force MyISAM database engine on MySQL versions older than 5.7.

Since MySQL 5.7, InnoDB engine supports FULLTEXT indexes, so forcing MyISAM is unnecessary.

Props xkon, joonasvanhatapio, SergeyBiryukov.
Fixes #49367.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dbdelta.php

    r47185 r47193  
    4141
    4242                $db_version = $wpdb->db_version();
     43                $db_engine  = '';
     44
     45                if ( version_compare( $db_version, '5.7', '<' ) ) {
     46                        // Forcing MyISAM, because InnoDB only started supporting FULLTEXT indexes in MySQL 5.7.
     47                        $db_engine = 'ENGINE=MyISAM';
     48                }
    4349
    4450                if ( version_compare( $db_version, '8.0.17', '<' ) ) {
     
    4753                }
    4854
    49                 // Forcing MyISAM, because InnoDB only started supporting FULLTEXT indexes in MySQL 5.7.
    5055                $wpdb->query(
    5156                        $wpdb->prepare(
     
    6065                                        KEY key_1 (column_1(%d)),
    6166                                        KEY compound_key (id,column_1(%d)),
    62                                         FULLTEXT KEY fulltext_key (column_1)
    63                                 ) ENGINE=MyISAM
     67                                        FULLTEXT KEY fulltext_key (column_1)" .
     68                                        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
     69                                ") $db_engine
    6470                                ",
    6571                                $this->max_index_length,
Note: See TracChangeset for help on using the changeset viewer.