How to fix Failed to create tmp table _fwbk_wp_wc_download_log | Unyson

 It seems that this error appears when backup was created on the old version on WooCommerce and you restore it on the new version:

 


 How to fix Failed to create tmp table _fwbk_wp_wc_download_log. Duplicate foreign key constraint name 'fk_wp_wc_download_log_permission_id'

I have fixed this by adding an additional check here


wp-content/plugins/unyson/framework/extensions/backups/includes/module/tasks/type/class-fw-ext-backups-task-type-db-restore.php

Try to replace this code:


foreach ( $line['data']['indexes'] as $index ) {
    $cols_sql[] = $index;
}

To this one:


foreach ( $line['data']['indexes'] as $index ) {
    if ( ! strpos($index,'fk_wp_wc_download_log_permission_id')){
        $cols_sql[] = $index;
    }
}


This worked for me

Post a Comment

Previous Post Next Post