get_row( "SHOW INDEX FROM {$wpdb->prefix}wc_order_stats WHERE key_name = 'status'" ); if ( property_exists( $index, 'Sub_part' ) ) { // The index was created with the right length. Time to bail. if ( $max_index_length === $index->Sub_part ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName return; } // We need to drop the index so it can be recreated. $wpdb->query( "DROP INDEX `status` ON {$wpdb->prefix}wc_order_stats" ); } // Recreate the status index with a max length. $wpdb->query( $wpdb->prepare( "ALTER TABLE {$wpdb->prefix}wc_order_stats ADD INDEX status (status(%d))", $max_index_length ) ); } /** * Update DB Version. */ function wc_admin_update_0201_db_version() { Installer::update_db_version( '0.20.1' ); }