namespace Yoast\WP\SEO\Config\Migrations;
use Yoast\WP\Lib\Migrations\Migration;
* ReplacePermalinkHashIndex class.
class ReplacePermalinkHashIndex extends Migration {
* The plugin this migration belongs to.
public static $plugin = 'free';
$table_name = $this->get_table_name();
$adapter = $this->get_adapter();
if ( ! $adapter->has_table( $table_name ) ) {
if ( $adapter->has_index( $table_name, [ 'permalink_hash' ], [ 'name' => 'permalink_hash' ] ) ) {
'name' => 'permalink_hash',
if ( ! $adapter->has_index( $table_name, [ 'permalink_hash', 'object_type' ], [ 'name' => 'permalink_hash_and_object_type' ] ) ) {
'name' => 'permalink_hash_and_object_type',
$table_name = $this->get_table_name();
$adapter = $this->get_adapter();
if ( ! $adapter->has_table( $table_name ) ) {
if ( $adapter->has_index( $table_name, [ 'permalink_hash', 'object_type' ], [ 'name' => 'permalink_hash_and_object_type' ] ) ) {
'name' => 'permalink_hash_and_object_type',
if ( ! $adapter->has_index( $table_name, [ 'permalink_hash' ], [ 'name' => 'permalink_hash' ] ) ) {
'name' => 'permalink_hash',
* Retrieves the table name to use for storing indexables.
* @return string The table name to use.
protected function get_table_name() {
return Model::get_table_name( 'Indexable' );