UpdraftPlus Home › Forums › Paid support forum – UpdraftPlus backup plugin › Migratioon issue with WooCommerce Downloads
Tagged: constraint, Database, downloads, migration., woocommerce
- This topic has 2 replies, 2 voices, and was last updated 4 years, 10 months ago by udadmin.
-
AuthorPosts
-
February 17, 2019 at 12:19 pm #349533mensmaximusParticipant
If you migrate a WordPress installation that includes WooCommerce with downloadable products those downloads will fail if the database prefix has changed. The issue stems from a constraint created by WooCommerce during the first install. The search and replace utility in Updraft Plus Pro does not fetch the constraint and thus does not change the database prefix in the foreign key.
Example:
old site: old.example.com
old db prefix: lmr_new site: new.example.com
new db prefix: arm_Downloading a file from the myaccount page in WooCommerce will fail with the following php error message:
Cannot add or update a child row: a foreign key constraint fails (‘new_site_db’.’arm_wc_download_log’, CONSTRAINT ‘fk_lmr_wc_download_log_permission_id’ FOREIGN KEY (‘permission_id’) REFERENCES ‘lmr_woocommerce_downloadable_product_permissions’ (‘permissio) für Abfrage INSERT INTO ‘arm_wc_download_log’ (‘timestamp’, ‘permission_id’, ‘user_id’, ‘user_ip_address’) VALUES (‘2019-02-17 11:20:32′, ’16’, ‘1’, ‘xx.xx.xx.xx’)
Solution:
The old foreign key must be droped and a new constraint must be created
ALTER TABLE ‘arm_wc_download_log’ DROP FOREIGN KEY ‘fk_lmr_wc_download_log_permission_id’;
ALTER TABLE ‘arm_wc_download_log’ ADD CONSTRAINT ‘fk_arm_wc_download_log_permission_id’ FOREIGN KEY (‘permission_id’) REFERENCES ‘arm_woocommerce_downloadable_product_permissions'(‘permission_id’) ON DELETE CASCADE ON UPDATE RESTRICT;Feature request:
Updraft Plus Pro Migration Utility should check whether WooCommerce is included in the WordPress installation and whether the database prefix has changed between the source and target site. If both conditions are true the foreign key as explained above should be droped and the constraint recreated.
Keep up the good work. UpdraftPlus Pro is by far the best backup and migration utility on the market. Greetings to Joe.
Kind regards
Michael
February 18, 2019 at 7:36 pm #350059udadminKeymasterHi Michael,
Thank you for this report. We have added an item to our internal task tracker to investigate.
David
June 11, 2019 at 10:17 pm #398936udadminKeymasterA fix for this has been merged into our development version, and will thus be in the next release.
-
AuthorPosts
- The topic ‘Migratioon issue with WooCommerce Downloads’ is closed to new replies.