makers99/wp-cli-shared-patches

Yoast database schema errors on first page load after importing clean dump

Closed this issue · 1 comments

sun commented

Problem

  • After importing a clean database dump of a site that has the Yoast wordpress-seo plugin enabled, the following errors appear on the first page load (but disappear afterwards).

Details

  • Most likely we are removing an option that stores the last database schema version. Without it, the plugin attempts to reinstall or update its tables.

Proposed solution

  1. Identify which option needs to be kept and ensure that it is retained in the clean database dump.

WordPress Database Error: [Table 'wp_yoast_indexable' already exists]
CREATE TABLE wp_yoast_indexable ( id int(11) UNSIGNED auto_increment NOT NULL, permalink mediumtext, permalink_hash varchar(191), object_id int(11) UNSIGNED, object_type varchar(32) NOT NULL, object_sub_type varchar(32), author_id int(11) UNSIGNED, post_parent int(11) UNSIGNED, title varchar(191), description text, breadcrumb_title varchar(191), post_status varchar(191), is_public tinyint(1), is_protected tinyint(1) DEFAULT '0', has_public_posts tinyint(1), number_of_pages int(11) UNSIGNED, canonical mediumtext, primary_focus_keyword varchar(191), primary_focus_keyword_score int(3), readability_score int(3), is_cornerstone tinyint(1) DEFAULT '0', is_robots_noindex tinyint(1) DEFAULT '0', is_robots_nofollow tinyint(1) DEFAULT '0', is_robots_noarchive tinyint(1) DEFAULT '0', is_robots_noimageindex tinyint(1) DEFAULT '0', is_robots_nosnippet tinyint(1) DEFAULT '0', twitter_title varchar(191), twitter_image mediumtext, twitter_description mediumtext, twitter_image_id varchar(191), twitter_image_source varchar(191), open_graph_title varchar(191), open_graph_description mediumtext, open_graph_image mediumtext, open_graph_image_id varchar(191), open_graph_image_source varchar(191), open_graph_image_meta text, link_count int(11), incoming_link_count int(11), prominent_words_version int(11) UNSIGNED, PRIMARY KEY (id)) DEFAULT CHARSET=utf8;

WordPress Database Error: [Duplicate key name 'object_type_and_sub_type']
CREATE INDEX object_type_and_sub_type ON wp_yoast_indexable(object_type, object_sub_type)

WordPress Database Error: [Duplicate column name 'created_at']
ALTER TABLE wp_yoast_indexable ADD created_at datetime

WordPress Database Error: [Duplicate column name 'updated_at']
ALTER TABLE wp_yoast_indexable ADD updated_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP

WordPress Database Error: [Table 'wp_yoast_primary_term' already exists]
CREATE TABLE wp_yoast_primary_term ( id int(11) UNSIGNED auto_increment NOT NULL, post_id int(11) UNSIGNED NOT NULL, term_id int(11) UNSIGNED NOT NULL, taxonomy varchar(32) NOT NULL, PRIMARY KEY (id)) DEFAULT CHARSET=utf8;

WordPress Database Error: [Duplicate key name 'post_taxonomy']
CREATE INDEX post_taxonomy ON wp_yoast_primary_term(post_id, taxonomy)

WordPress Database Error: [Duplicate key name 'post_term']
CREATE INDEX post_term ON wp_yoast_primary_term(post_id, term_id)

WordPress Database Error: [Duplicate column name 'created_at']
ALTER TABLE wp_yoast_primary_term ADD created_at datetime

WordPress Database Error: [Duplicate column name 'updated_at']
ALTER TABLE wp_yoast_primary_term ADD updated_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP

WordPress Database Error: [Table 'wp_yoast_indexable_hierarchy' already exists]
CREATE TABLE wp_yoast_indexable_hierarchy ( indexable_id int(11) UNSIGNED, ancestor_id int(11) UNSIGNED, depth int(11) UNSIGNED, PRIMARY KEY (indexable_id,ancestor_id)) DEFAULT CHARSET=utf8;

WordPress Database Error: [Duplicate key name 'indexable_id']
CREATE INDEX indexable_id ON wp_yoast_indexable_hierarchy(indexable_id)

WordPress Database Error: [Duplicate key name 'ancestor_id']
CREATE INDEX ancestor_id ON wp_yoast_indexable_hierarchy(ancestor_id)

WordPress Database Error: [Duplicate key name 'depth']
CREATE INDEX depth ON wp_yoast_indexable_hierarchy(depth)

WordPress Database Error: [Duplicate column name 'blog_id']
ALTER TABLE wp_yoast_indexable ADD blog_id bigint(20) DEFAULT 1 NOT NULL

WordPress Database Error: [Duplicate column name 'blog_id']
ALTER TABLE wp_yoast_indexable_hierarchy ADD blog_id bigint(20) DEFAULT 1 NOT NULL

WordPress Database Error: [Duplicate column name 'blog_id']
ALTER TABLE wp_yoast_primary_term ADD blog_id bigint(20) DEFAULT 1 NOT NULL

WordPress Database Error: [Duplicate column name 'language']
ALTER TABLE wp_yoast_indexable ADD language varchar(32)

WordPress Database Error: [Duplicate column name 'region']
ALTER TABLE wp_yoast_indexable ADD region varchar(32)

WordPress Database Error: [Duplicate column name 'schema_page_type']
ALTER TABLE wp_yoast_indexable ADD schema_page_type varchar(64)

WordPress Database Error: [Duplicate column name 'schema_article_type']
ALTER TABLE wp_yoast_indexable ADD schema_article_type varchar(64)

WordPress Database Error: [Duplicate key name 'object_id_and_type']
CREATE INDEX object_id_and_type ON wp_yoast_indexable(object_id, object_type)

WordPress Database Error: [Duplicate column name 'has_ancestors']
ALTER TABLE wp_yoast_indexable ADD has_ancestors tinyint(1) DEFAULT '0'

WordPress Database Error: [Duplicate column name 'indexable_id']
ALTER TABLE wp_yoast_seo_links ADD indexable_id int(11) UNSIGNED

WordPress Database Error: [Duplicate column name 'target_indexable_id']
ALTER TABLE wp_yoast_seo_links ADD target_indexable_id int(11) UNSIGNED

WordPress Database Error: [Duplicate column name 'height']
ALTER TABLE wp_yoast_seo_links ADD height int(11) UNSIGNED

WordPress Database Error: [Duplicate column name 'width']
ALTER TABLE wp_yoast_seo_links ADD width int(11) UNSIGNED

WordPress Database Error: [Duplicate column name 'size']
ALTER TABLE wp_yoast_seo_links ADD size int(11) UNSIGNED

WordPress Database Error: [Duplicate column name 'language']
ALTER TABLE wp_yoast_seo_links ADD language varchar(32)

WordPress Database Error: [Duplicate column name 'region']
ALTER TABLE wp_yoast_seo_links ADD region varchar(32)

WordPress Database Error: [Duplicate key name 'indexable_link_direction']
CREATE INDEX indexable_link_direction ON wp_yoast_seo_links(indexable_id, type)

WordPress Database Error: [Duplicate key name 'subpages']
CREATE INDEX subpages ON wp_yoast_indexable(post_parent, object_type, post_status, object_id)

WordPress Database Error: [Duplicate column name 'estimated_reading_time_minutes']
ALTER TABLE wp_yoast_indexable ADD estimated_reading_time_minutes int(11)

sun commented

Sorry, wrong repo. This was meant for https://github.com/makers99/wp-cli-db-export-clean