namespace Yoast\WP\SEO\Config\Migrations;
use Yoast\WP\Lib\Migrations\Migration;
class WpYoastIndexable extends Migration {
* The plugin this migration belongs to.
public static $plugin = 'free';
$this->drop_table( $this->get_table_name() );
* Creates the indexable table.
private function add_table() {
$table_name = $this->get_table_name();
$indexable_table = $this->create_table( $table_name );
$indexable_table->column( 'permalink', 'mediumtext', [ 'null' => true ] );
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
// Title and description.
$indexable_table->column(
$indexable_table->column( 'description', 'text', [ 'null' => true ] );
$indexable_table->column(
// Post metadata: status, public, protected.
$indexable_table->column(
$indexable_table->column(
$indexable_table->column( 'is_protected', 'boolean', [ 'default' => false ] );
$indexable_table->column(
$indexable_table->column(
$indexable_table->column( 'canonical', 'mediumtext', [ 'null' => true ] );
// SEO and readability analysis.
$indexable_table->column(
$indexable_table->column(
'primary_focus_keyword_score',
$indexable_table->column(
$indexable_table->column( 'is_cornerstone', 'boolean', [ 'default' => false ] );
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
'is_robots_noimageindex',
$indexable_table->column(
$indexable_table->column(
$indexable_table->column( 'twitter_image', 'mediumtext', [ 'null' => true ] );
$indexable_table->column( 'twitter_description', 'mediumtext', [ 'null' => true ] );
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
$indexable_table->column( 'open_graph_description', 'mediumtext', [ 'null' => true ] );
$indexable_table->column( 'open_graph_image', 'mediumtext', [ 'null' => true ] );
$indexable_table->column(
$indexable_table->column(
'open_graph_image_source',
$indexable_table->column( 'open_graph_image_meta', 'text', [ 'null' => true ] );
$indexable_table->column(
$indexable_table->column(
$indexable_table->column(
'prominent_words_version',
$indexable_table->finish();
$this->add_indexes( $table_name );
$this->add_timestamps( $table_name );
* Adds indexes to the indexable table.
* @param string $indexable_table_name The name of the indexable table.
private function add_indexes( $indexable_table_name ) {
'name' => 'object_type_and_sub_type',
'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' );