![]() ![]() This will show you all your tables and the engines they use. Run the following MySQL query via phpMyAdmin, TablePlus, or your MySQL client of choice. Next up, let’s confirm that mismatched tables are even your problem. To fix the above error and get our WooCommerce migrations to run properly, we need to convert our old tables to InnoDB and then re-run the migrations.įirst, take a backup of your database. And now you have tables with mismatched engines. The new tables added after your MySQL update will be InnoDB. WooCommerce creates a lot of new tables in the WordPress database for better performance, and continues to add and alter them over time. They’re still MyISAM.įinally, let’s say you update WooCommerce, and that update includes some new tables. The default engine is now InnoDB, but your existing tables won’t change. Then let’s say you upgraded MySQL to version 5.5 or greater, either on your existing hosting or as part of a hosting migration (which we’re often doing with new clients here at Sterner Stuff). If you originally installed your WordPress site with MySQL pre-5.5, you would get MyISAM tables, specifically for your WordPress core tables and any tables created by plugins you installed, like WooCommerce. Prior to MySQL 5.5, the default database engine was MyISAM. ![]() How did we get into this mess?įirst, how did we even end up with different engines on different tables? MySQL is unable to add a foreign key to one of our tables.Ī quick Google turned up this GitHub issue, which suggested the problem could be that we’re running two different MySQL engines across our tables. What we’re seeing here is that part of WooCommerce’s installation and table creation logic is failing (which, thanks to WordPress’s magic dbDelta functionality, safely runs every time WooCommerce updates). While deploying updates, we got this error: WordPress database error Cannot add foreign key constraint for query ALTER TABLE wp_wc_download_log ADD FOREIGN KEY (permission_id) REFERENCES wp_woocommerce_downloadable_product_permissions(permission_id) ON DELETE CASCADE made by require( 'wp-blog-header.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::create_tables Code language: PHP ( php ) ![]() This recently became an issue for us running some WooCommerce updates on a client site. So while it may seem like a brand new site, we’ve kept valuable content.īut sometimes that means old data and new data don’t play nicely. When possible, we’ll repurpose as much of a WordPress site as possible when implementing a new design, features, etc. We call that stuff “equity”, and no one wants to throw away equity. Here at Sterner Stuff, we don’t like throwing away existing websites and content. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |