uname -aLinux XXX 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux# set MAGENTO_USER=..... , VERSION=2.2.0
su $MAGENTO_USER -c 'composer require magento/product-community-edition $VERSION --no-update'
su $MAGENTO_USER -c 'composer update'
Updates all fine, sun shines.
Update fails, it rains. Truncated output:
[...]
Updating modules:
Schema creation/updates:
Module 'Magento_Store':
[...]
Module 'Magento_OfflinePayments':
Module 'Magento_SalesRule':
Upgrading data.. SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-0-0-0' for key 'PRIMARY', query was: INSERT INTO `salesrule_product_attribute` () VALUES ()
Any way to debug this any further?
If You haven't custom sales rule, only sample-data run this Query in PhpMyAdmin
TRUNCATE TABLE salesrule;
TRUNCATE TABLE salesrule_coupon;
TRUNCATE TABLE salesrule_coupon_usage;
TRUNCATE TABLE salesrule_customer;
TRUNCATE TABLE salesrule_product_attribute;
And after run php bin/magento setup:upgrade
Hi @fwolfst
For migration related issues please use the correct repository: https://github.com/magento/data-migration-tool
Thank you.
I'm curious if you ever got this resolved, I'm seeing the same problem and no corresponding issue in the data-migration-tool repository.
@msm93v2 Afair we deleted the salesrules.
Have you found a workaround for this bug?
@TechOS-PL what if I have custom sales rules?
my workaround (not sure if it causes further errors, just did it and setup:upgrade reported success)
vendor/magento/module-sales-rule/Model/ResourceModel/Rule.php line 352
$connection->insertMultiple($this->getTable('salesrule_product_attribute'), $data);
wrap it in
if (!empty($data)) {
$connection->insertMultiple($this->getTable('salesrule_product_attribute'), $data);
}
@asavchenko same worked for me
@bpoiss @asavchenko Could you please say if this causes unexpected behaviour along the way?
@victortodoran no it didn't cause any issues, I did this on multiple systems and it always worked for me
@asavchenko thanks for the fix, it worked for me also.
@deepikajaniyani please reply me I need help
Most helpful comment
my workaround (not sure if it causes further errors, just did it and setup:upgrade reported success)
vendor/magento/module-sales-rule/Model/ResourceModel/Rule.php line 352
$connection->insertMultiple($this->getTable('salesrule_product_attribute'), $data);wrap it in