Make WordPress Core

Changeset 47195


Ignore:
Timestamp:
02/05/2020 10:05:50 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Tests: In Tests_dbDelta, 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.

Follow-up to [47193], which addressed the issue in Tests_dbDelta::setUp(), but missed other tests.

Props xkon, joonasvanhatapio, SergeyBiryukov.
Fixes #49367.

File:
1 edited

Legend:

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

    r47193 r47195  
    1616
    1717        /**
     18         * Database engine used for creating tables.
     19         *
     20         * Prior to MySQL 5.7, InnoDB did not support FULLTEXT indexes, so MyISAM is used instead.
     21         */
     22        protected $db_engine = '';
     23
     24        /**
    1825         * Display width for BIGINT data type.
    1926         *
     
    4148
    4249                $db_version = $wpdb->db_version();
    43                 $db_engine  = '';
    4450
    4551                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';
     52                        // Prior to MySQL 5.7, InnoDB did not support FULLTEXT indexes, so MyISAM is used instead.
     53                        $this->db_engine = 'ENGINE=MyISAM';
    4854                }
    4955
     
    6773                                        FULLTEXT KEY fulltext_key (column_1)" .
    6874                                        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    69                                 ") $db_engine
     75                                ") {$this->db_engine}
    7076                                ",
    7177                                $this->max_index_length,
     
    451457                                KEY compound_key (id,column_1($this->max_index_length)),
    452458                                FULLTEXT KEY fulltext_key (column_1)
    453                         ) ENGINE=MyISAM
     459                        ) {$this->db_engine}
    454460                        ",
    455461                        false
     
    476482                                KEY compound_key (id,column_1($this->max_index_length)),
    477483                                FULLTEXT KEY fulltext_key (column_1)
    478                         ) ENGINE=MyISAM
     484                        ) {$this->db_engine}
    479485                        ",
    480486                        false
     
    501507                                KEY compound_key (id,column_1($this->max_index_length)),
    502508                                FULLTEXT KEY fulltext_key (column_1)
    503                         ) ENGINE=MyISAM
     509                        ) {$this->db_engine}
    504510                        ",
    505511                        false
     
    532538                                KEY compound_key (id,column_1($this->max_index_length)),
    533539                                FULLTEXT KEY fulltext_key (column_1)
    534                         ) ENGINE=MyISAM
     540                        ) {$this->db_engine}
    535541                        ",
    536542                        false
     
    597603                                KEY non_spatial (non_spatial),
    598604                                SPATIAL KEY spatial_key (spatial_value)
    599                         ) ENGINE=MyISAM;
     605                        ) {$this->db_engine};
    600606                        ";
    601607
     
    616622                                SPATIAL KEY spatial_key (spatial_value)
    617623                                SPATIAL KEY spatial_key2 (spatial_value2)
    618                         ) ENGINE=MyISAM;
     624                        ) {$this->db_engine};
    619625                        ";
    620626
     
    680686                                KEY compound_key2 (id,`references`($this->max_index_length)),
    681687                                FULLTEXT KEY fulltext_key (column_1)
    682                         ) ENGINE=MyISAM
     688                        ) {$this->db_engine}
    683689                        "
    684690                );
     
    726732                                UNIQUE INDEX key_4 (column_1($this->max_index_length)),
    727733                                FULLTEXT INDEX key_5 (column_1),
    728                         ) ENGINE=MyISAM
     734                        ) {$this->db_engine}
    729735                ";
    730736
     
    761767                                INDEX compound_key (id,column_1($this->max_index_length)),
    762768                                FULLTEXT INDEX fulltext_key (column_1)
    763                         ) ENGINE=MyISAM
     769                        ) {$this->db_engine}
    764770                        "
    765771                );
     
    786792                                KEY key_2 (column_1(10)),
    787793                                KEY key_3 (column_2(100),column_1(10)),
    788                         ) ENGINE=MyISAM
     794                        ) {$this->db_engine}
    789795                ";
    790796
     
    819825                                KEY compound_key (id,column_1($this->max_index_length) ASC),
    820826                                FULLTEXT KEY fulltext_key (column_1)
    821                         ) ENGINE=MyISAM
     827                        ) {$this->db_engine}
    822828                        "
    823829                );
     
    843849                                KEY compound_key (id,column_1($this->max_index_length)),
    844850                                FULLTEXT KEY fulltext_key (column_1)
    845                         ) ENGINE=MyISAM
     851                        ) {$this->db_engine}
    846852                        "
    847853                );
     
    867873                                KEY compound_key (id,      column_1($this->max_index_length)),
    868874                                FULLTEXT KEY fulltext_key (column_1)
    869                         ) ENGINE=MyISAM
     875                        ) {$this->db_engine}
    870876                        "
    871877                );
     
    891897                                key compound_key (id,column_1($this->max_index_length)),
    892898                                FULLTEXT KEY fulltext_key (column_1)
    893                         ) ENGINE=MyISAM
     899                        ) {$this->db_engine}
    894900                        "
    895901                );
     
    915921                                KEY compOUND_key (id,column_1($this->max_index_length)),
    916922                                FULLTEXT KEY FULLtext_kEY (column_1)
    917                         ) ENGINE=MyISAM
     923                        ) {$this->db_engine}
    918924                        ",
    919925                        false
     
    940946                                KEY compound_key (id,column_1($this->max_index_length)),
    941947                                FULLTEXT KEY fulltext_key (column_1)
    942                         ) ENGINE=MyISAM
     948                        ) {$this->db_engine}
    943949                        ",
    944950                        false
     
    966972                                KEY changing_key_length (column_1(20)),
    967973                                FULLTEXT KEY fulltext_key (column_1)
    968                         ) ENGINE=MyISAM
     974                        ) {$this->db_engine}
    969975                        "
    970976                );
     
    989995                                KEY changing_key_length (column_1(50)),
    990996                                FULLTEXT KEY fulltext_key (column_1)
    991                         ) ENGINE=MyISAM
     997                        ) {$this->db_engine}
    992998                        "
    993999                );
     
    10071013                                KEY changing_key_length (column_1(1)),
    10081014                                FULLTEXT KEY fulltext_key (column_1)
    1009                         ) ENGINE=MyISAM
     1015                        ) {$this->db_engine}
    10101016                        "
    10111017                );
     
    10251031                                KEY changing_key_length (column_1),
    10261032                                FULLTEXT KEY fulltext_key (column_1)
    1027                         ) ENGINE=MyISAM
     1033                        ) {$this->db_engine}
    10281034                        "
    10291035                );
Note: See TracChangeset for help on using the changeset viewer.