This topic contains 1 reply, has 2 voices, and was last updated by udadmin 3 months ago.
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.
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’)
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;
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.
February 18, 2019 at 7:36 pm #350059udadminKeymaster
- This topic was modified 3 months ago by mensmaximus. Reason: code formatting
- This topic was modified 3 months ago by mensmaximus.
- This topic was modified 3 months ago by mensmaximus. Reason: code fromating
Thank you for this report. We have added an item to our internal task tracker to investigate.
The topic ‘Migratioon issue with WooCommerce Downloads’ is closed to new replies.