Migratioon issue with WooCommerce Downloads

UpdraftPlus Home Forums Paid support forum – UpdraftPlus backup plugin Migratioon issue with WooCommerce Downloads

This topic contains 2 replies, has 2 voices, and was last updated by  udadmin 2 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #349533

    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;

    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


    • This topic was modified 6 months, 1 week ago by  mensmaximus. Reason: code formatting
    • This topic was modified 6 months, 1 week ago by  mensmaximus.
    • This topic was modified 6 months, 1 week ago by  mensmaximus. Reason: code fromating

    Hi Michael,

    Thank you for this report. We have added an item to our internal task tracker to investigate.



    A fix for this has been merged into our development version, and will thus be in the next release.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Migratioon issue with WooCommerce Downloads’ is closed to new replies.