Support » Plugin: WooCommerce » WordPress database error Table during upgrade to 4.0

  • During 4.0 upgrade, go the log filled with many entries of those below. The table described is available after update. Is it there anything I should do or be concerned about? Thanks.

    
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_notes' doesn't exist for query SELECT note_id FROM wp_eb51a9edfd_wc_admin_notes WHERE name = 'wc-update-db-reminder' ORDER BY note_id ASC made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::check_version, WC_Install::install, WC_Install::maybe_update_db_version, WC_Notes_Run_Db_Update::show_reminder, WC_Notes_Run_Db_Update::get_current_notice, WC_Data_Store->__call, Automattic\WooCommerce\Admin\Notes\DataStore->get_notes_with_name
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_notes' doesn't exist for query SHOW FULL COLUMNS FROM <code>wp_eb51a9edfd_wc_admin_notes</code> made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::check_version, WC_Install::install, WC_Install::maybe_update_db_version, WC_Notes_Run_Db_Update::show_reminder, WC_Notes_Run_Db_Update::update_needed_notice, WC_Data->save, WC_Data_Store->create, Automattic\WooCommerce\Admin\Notes\DataStore->create
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_note_actions' doesn't exist for query DELETE FROM wp_eb51a9edfd_wc_admin_note_actions WHERE note_id = 0 made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::check_version, WC_Install::install, WC_Install::maybe_update_db_version, WC_Notes_Run_Db_Update::show_reminder, WC_Notes_Run_Db_Update::update_needed_notice, WC_Data->save, WC_Data_Store->create, Automattic\WooCommerce\Admin\Notes\DataStore->create, Automattic\WooCommerce\Admin\Notes\DataStore->save_actions
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_note_actions' doesn't exist for query SHOW FULL COLUMNS FROM <code>wp_eb51a9edfd_wc_admin_note_actions</code> made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::check_version, WC_Install::install, WC_Install::maybe_update_db_version, WC_Notes_Run_Db_Update::show_reminder, WC_Notes_Run_Db_Update::update_needed_notice, WC_Data->save, WC_Data_Store->create, Automattic\WooCommerce\Admin\Notes\DataStore->create, Automattic\WooCommerce\Admin\Notes\DataStore->save_actions
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_note_actions' doesn't exist for query SHOW FULL COLUMNS FROM <code>wp_eb51a9edfd_wc_admin_note_actions</code> made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::check_version, WC_Install::install, WC_Install::maybe_update_db_version, WC_Notes_Run_Db_Update::show_reminder, WC_Notes_Run_Db_Update::update_needed_notice, WC_Data->save, WC_Data_Store->create, Automattic\WooCommerce\Admin\Notes\DataStore->create, Automattic\WooCommerce\Admin\Notes\DataStore->save_actions
    WordPress database error Table 'my-domain-wp-Tm6qKxT9.wp_eb51a9edfd_wc_admin_note_actions' doesn't exist for query SELECT action_id, name, label, query, status, is_primary
    				FROM wp_eb51a9edfd_wc_admin_note_actions
    
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author peterfabian1000

    (@peterfabian1000)

    Hi @alx359 , thanks for reporting this back to us!

    If the tables wc_admin_notes and wc_admin_note_actions do exist, there should be no reason for concern. Seems like you hit some edge case where WC Admin was already running, but not all tables were in place yet.

    Please be sure to run the database update if you haven’t done it yet (e.g. from WooCommerce > Status > Tools > Update database)

    I’ve created an issue in GitHub to make sure we’ll look into the problem: https://github.com/woocommerce/woocommerce/issues/25876

    I’m not sure this is an edge case. I’ve gotten this set of errors on every WC site I’ve updated, and I’m up to five now, all of which have the same set of errors. Out of the five, three did not have the WC Admin running elsewhere, if that helps.

    Plugin Author peterfabian1000

    (@peterfabian1000)

    Thanks for sharing your experience, @linux4me2 . We’re already working on a fix for this and will publish it with the next update.

    I have similar problem after updating to 4.0.

    Complains in the error log about missing tables:

    wc_admin_notes
    wc_admin_note_actions
    wp_actionscheduler_actions

    Should I have those?

    But in my case I think that I used WP-Optimize plugin to delete those tables after the upgrade to 4.0. If I recall correctly the plugin said that these tables were no longer in use.

    Thanks.

    WooCommerce Admin related database tables in the WooCommerce 4.0 update;

    wp_wc_admin_notes	
    wp_wc_admin_note_actions	
    wp_wc_category_lookup	 	
    wp_wc_customer_lookup
    wp_wc_order_coupon_lookup
    wp_wc_order_product_lookup
    wp_wc_order_stats
    wp_wc_order_tax_lookup
    • This reply was modified 1 year, 7 months ago by Luke Cavanagh. Reason: clarify wording

    Thanks for helping.

    I just uninstalled Woocommerce, cron jobs weren’t working with it activated. I’ll reinstall Woocommerce again when a new version arrives, if lucky it might recreate those missing tables.

    Same errors in log:
    .wp_wc_order_stats’ doesn’t exist
    .wp_wc_customer_lookup’ doesn’t exist
    .wp_wc_order_stats’ doesn’t exist
    .wp_wc_order_product_lookup’ doesn’t exist
    .wp_wc_order_coupon_lookup’ doesn’t exist

    tables do not exist in my database. Tryied to uninstall woocommerce, delate tables and reinstall but still missing tables.

    I don’t have any of these tables:
    wp_wc_admin_notes
    wp_wc_admin_note_actions
    wp_wc_category_lookup
    wp_wc_customer_lookup
    wp_wc_order_coupon_lookup
    wp_wc_order_product_lookup
    wp_wc_order_stats
    wp_wc_order_tax_lookup

    Hi @elegraf and others,

    Any update on this? How did you resolve it? I encountered the same problem after using WP Optimize plugin, probably deleting some of those tables. Reinstalling WooCommerce didn’t help. Particularly, this is the table I am missing: “wp_actionscheduler_actions”.

    “WooCommerce > Status > Tools > Update database” does not work, and cron jobs are affected also.

    I would like to have an SQL code that can recreate this table!

    HI @roxymathew,
    I had a local version with the right tables in database. I have copied manually the tables and the problem disappeared.

    This is the SQL…hope can help you:

    CREATE TABLE IF NOT EXISTS wp_wc_admin_notes (
    note_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    type varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
    locale varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
    title longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    content longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    icon varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    content_data longtext COLLATE utf8mb4_unicode_ci,
    status varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    source varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    date_reminder datetime DEFAULT NULL,
    is_snoozable tinyint(1) NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (note_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_admin_note_actions (
    action_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    note_id bigint(20) unsigned NOT NULL,
    name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    label varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    query longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    status varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    is_primary tinyint(1) NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (action_id),
    KEY note_id (note_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_category_lookup (
    category_tree_id bigint(20) unsigned NOT NULL,
    category_id bigint(20) unsigned NOT NULL,
    PRIMARY KEY (category_tree_id,category_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_customer_lookup (
    customer_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    user_id bigint(20) unsigned DEFAULT NULL,
    username varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    first_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    last_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    email varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    date_last_active timestamp NULL DEFAULT NULL,
    date_registered timestamp NULL DEFAULT NULL,
    country char(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    postcode varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    city varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    state varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    PRIMARY KEY (customer_id),
    UNIQUE KEY user_id (user_id),
    KEY email (email)
    ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_download_log (
    download_log_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    timestamp datetime NOT NULL,
    permission_id bigint(20) unsigned NOT NULL,
    user_id bigint(20) unsigned DEFAULT NULL,
    user_ip_address varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT ”,
    PRIMARY KEY (download_log_id),
    KEY permission_id (permission_id),
    KEY timestamp (timestamp),
    CONSTRAINT fk_wp_wc_download_log_permission_id FOREIGN KEY (permission_id) REFERENCES wp_woocommerce_downloadable_product_permissions (permission_id) ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_order_coupon_lookup (
    order_id bigint(20) unsigned NOT NULL,
    coupon_id bigint(20) unsigned NOT NULL,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    discount_amount double NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (order_id,coupon_id),
    KEY coupon_id (coupon_id),
    KEY date_created (date_created)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_order_product_lookup (
    order_item_id bigint(20) unsigned NOT NULL,
    order_id bigint(20) unsigned NOT NULL,
    product_id bigint(20) unsigned NOT NULL,
    variation_id bigint(20) unsigned NOT NULL,
    customer_id bigint(20) unsigned DEFAULT NULL,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    product_qty int(11) NOT NULL,
    product_net_revenue double NOT NULL DEFAULT ‘0’,
    product_gross_revenue double NOT NULL DEFAULT ‘0’,
    coupon_amount double NOT NULL DEFAULT ‘0’,
    tax_amount double NOT NULL DEFAULT ‘0’,
    shipping_amount double NOT NULL DEFAULT ‘0’,
    shipping_tax_amount double NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (order_item_id),
    KEY order_id (order_id),
    KEY product_id (product_id),
    KEY customer_id (customer_id),
    KEY date_created (date_created)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_order_stats (
    order_id bigint(20) unsigned NOT NULL,
    parent_id bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    date_created_gmt datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    num_items_sold int(11) NOT NULL DEFAULT ‘0’,
    total_sales double NOT NULL DEFAULT ‘0’,
    tax_total double NOT NULL DEFAULT ‘0’,
    shipping_total double NOT NULL DEFAULT ‘0’,
    net_total double NOT NULL DEFAULT ‘0’,
    returning_customer tinyint(1) DEFAULT NULL,
    status varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    customer_id bigint(20) unsigned NOT NULL,
    PRIMARY KEY (order_id),
    KEY date_created (date_created),
    KEY customer_id (customer_id),
    KEY status (status(191))
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_order_tax_lookup (
    order_id bigint(20) unsigned NOT NULL,
    tax_rate_id bigint(20) unsigned NOT NULL,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    shipping_tax double NOT NULL DEFAULT ‘0’,
    order_tax double NOT NULL DEFAULT ‘0’,
    total_tax double NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (order_id,tax_rate_id),
    KEY tax_rate_id (tax_rate_id),
    KEY date_created (date_created)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_product_meta_lookup (
    product_id bigint(20) NOT NULL,
    sku varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT ”,
    virtual tinyint(1) DEFAULT ‘0’,
    downloadable tinyint(1) DEFAULT ‘0’,
    min_price decimal(19,4) DEFAULT NULL,
    max_price decimal(19,4) DEFAULT NULL,
    onsale tinyint(1) DEFAULT ‘0’,
    stock_quantity double DEFAULT NULL,
    stock_status varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT ‘instock’,
    rating_count bigint(20) DEFAULT ‘0’,
    average_rating decimal(3,2) DEFAULT ‘0.00’,
    total_sales bigint(20) DEFAULT ‘0’,
    tax_status varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT ‘taxable’,
    tax_class varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT ”,
    PRIMARY KEY (product_id),
    KEY virtual (virtual),
    KEY downloadable (downloadable),
    KEY stock_status (stock_status),
    KEY stock_quantity (stock_quantity),
    KEY onsale (onsale),
    KEY min_max_price (min_price,max_price)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_tax_rate_classes (
    tax_rate_class_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    slug varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    PRIMARY KEY (tax_rate_class_id),
    UNIQUE KEY slug (slug(191))
    ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_wc_webhooks (
    webhook_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    status varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    name text COLLATE utf8mb4_unicode_ci NOT NULL,
    user_id bigint(20) unsigned NOT NULL,
    delivery_url text COLLATE utf8mb4_unicode_ci NOT NULL,
    secret text COLLATE utf8mb4_unicode_ci NOT NULL,
    topic varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    date_created datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    date_created_gmt datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    date_modified datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    date_modified_gmt datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    api_version smallint(4) NOT NULL,
    failure_count smallint(10) NOT NULL DEFAULT ‘0’,
    pending_delivery tinyint(1) NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (webhook_id),
    KEY user_id (user_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_api_keys (
    key_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    user_id bigint(20) unsigned NOT NULL,
    description varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    permissions varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
    consumer_key char(64) COLLATE utf8mb4_unicode_ci NOT NULL,
    consumer_secret char(43) COLLATE utf8mb4_unicode_ci NOT NULL,
    nonces longtext COLLATE utf8mb4_unicode_ci,
    truncated_key char(7) COLLATE utf8mb4_unicode_ci NOT NULL,
    last_access datetime DEFAULT NULL,
    PRIMARY KEY (key_id),
    KEY consumer_key (consumer_key),
    KEY consumer_secret (consumer_secret)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_attribute_taxonomies (
    attribute_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    attribute_name varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    attribute_label varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    attribute_type varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
    attribute_orderby varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
    attribute_public int(1) NOT NULL DEFAULT ‘1’,
    PRIMARY KEY (attribute_id),
    KEY attribute_name (attribute_name(20))
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_downloadable_product_permissions (
    permission_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    download_id varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
    product_id bigint(20) unsigned NOT NULL,
    order_id bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    order_key varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    user_email varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    user_id bigint(20) unsigned DEFAULT NULL,
    downloads_remaining varchar(9) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    access_granted datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    access_expires datetime DEFAULT NULL,
    download_count bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (permission_id),
    KEY download_order_key_product (product_id,order_id,order_key(16),download_id),
    KEY download_order_product (download_id,order_id,product_id),
    KEY order_id (order_id),
    KEY user_order_remaining_expires (user_id,order_id,downloads_remaining,access_expires)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_log (
    log_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    timestamp datetime NOT NULL,
    level smallint(4) NOT NULL,
    source varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    message longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    context longtext COLLATE utf8mb4_unicode_ci,
    PRIMARY KEY (log_id),
    KEY level (level)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_order_itemmeta (
    meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    order_item_id bigint(20) unsigned NOT NULL,
    meta_key varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    meta_value longtext COLLATE utf8mb4_unicode_ci,
    PRIMARY KEY (meta_id),
    KEY order_item_id (order_item_id),
    KEY meta_key (meta_key(32))
    ) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_order_items (
    order_item_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    order_item_name text COLLATE utf8mb4_unicode_ci NOT NULL,
    order_item_type varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    order_id bigint(20) unsigned NOT NULL,
    PRIMARY KEY (order_item_id),
    KEY order_id (order_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_payment_tokenmeta (
    meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    payment_token_id bigint(20) unsigned NOT NULL,
    meta_key varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    meta_value longtext COLLATE utf8mb4_unicode_ci,
    PRIMARY KEY (meta_id),
    KEY payment_token_id (payment_token_id),
    KEY meta_key (meta_key(32))
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_payment_tokens (
    token_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    gateway_id varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    token text COLLATE utf8mb4_unicode_ci NOT NULL,
    user_id bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    type varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    is_default tinyint(1) NOT NULL DEFAULT ‘0’,
    PRIMARY KEY (token_id),
    KEY user_id (user_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_sessions (
    session_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    session_key char(32) COLLATE utf8mb4_unicode_ci NOT NULL,
    session_value longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    session_expiry bigint(20) unsigned NOT NULL,
    PRIMARY KEY (session_id),
    UNIQUE KEY session_key (session_key)
    ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_shipping_zones (
    zone_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    zone_name varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    zone_order bigint(20) unsigned NOT NULL,
    PRIMARY KEY (zone_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_shipping_zone_locations (
    location_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    zone_id bigint(20) unsigned NOT NULL,
    location_code varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    location_type varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
    PRIMARY KEY (location_id),
    KEY location_id (location_id),
    KEY location_type_code (location_type(10),location_code(20))
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_shipping_zone_methods (
    zone_id bigint(20) unsigned NOT NULL,
    instance_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    method_id varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    method_order bigint(20) unsigned NOT NULL,
    is_enabled tinyint(1) NOT NULL DEFAULT ‘1’,
    PRIMARY KEY (instance_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_tax_rates (
    tax_rate_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    tax_rate_country varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    tax_rate_state varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    tax_rate varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    tax_rate_name varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    tax_rate_priority bigint(20) unsigned NOT NULL,
    tax_rate_compound int(1) NOT NULL DEFAULT ‘0’,
    tax_rate_shipping int(1) NOT NULL DEFAULT ‘1’,
    tax_rate_order bigint(20) unsigned NOT NULL,
    tax_rate_class varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    PRIMARY KEY (tax_rate_id),
    KEY tax_rate_country (tax_rate_country),
    KEY tax_rate_state (tax_rate_state(2)),
    KEY tax_rate_class (tax_rate_class(10)),
    KEY tax_rate_priority (tax_rate_priority)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS wp_woocommerce_tax_rate_locations (
    location_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    location_code varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
    tax_rate_id bigint(20) unsigned NOT NULL,
    location_type varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
    PRIMARY KEY (location_id),
    KEY tax_rate_id (tax_rate_id),
    KEY location_type_code (location_type(10),location_code(20))
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    Thanks, elegraf. I recreated the missing MySQL tables and seems most of the errors are gone.

    Hi @pushevs @roxymathew, I had the same problem due to the use of the WPO Optimization plugin, I deleted the tables in one of my stores…fortunately I noticed the error inmediately and didn´t commit the same mistake in the rest of my shops.

    I updated another store to the latest version, and through phpMyAdmin I exported the following tables (structure and data) to a SQL file:

    wp_actionscheduler_actions
    wp_actionscheduler_claims
    wp_actionscheduler_groups
    wp_actionscheduler_logs
    wp_wc_admin_notes
    wp_wc_admin_note_actions
    wp_wc_category_lookup
    wp_wc_customer_lookup
    wp_wc_order_coupon_lookup
    wp_wc_order_product_lookup
    wp_wc_order_stats
    wp_wc_order_tax_lookup

    Then I imported the SQL file into the damaged database, and the problem seems to have disappeared, at least in the front end.

    Just in case, make a backup before and after implementing this idea, in my case it worked, and I put it here just in case it is helpful, while Woocommerce fixes this problem definitively.

    By the way, it would not be bad if we are not forced to install the administration panel, which continues to generate errors in the backend.

    However, in the frontend it seems to be fixed.

    Thanks for your reply @juanbarham

    I did fix the problem weeks ago by downgrading from 4.0.0 to the previous version of woocommerce that gave no errors. Yesterday I upgraded to 4.0.1 and Woocommerce no longer complains about missing tables.

    I noticed that with Woocommerce 4.0.0 activated cron jobs weren’t working, that must have prevented Woocommerce to update and recreate tables…

    All it’s good now.

    • This reply was modified 1 year, 7 months ago by pushevs.
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘WordPress database error Table during upgrade to 4.0’ is closed to new replies.