You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seen on Magento OS 2.4.6-p2 with MSI modules at version 1.2.6-p2
Steps to reproduce (*)
We have a client with this super old Magento shop on version 2.2.3 that we are finally upgrading to 2.4.6-p2
This old shop has a module Magestore_Webpos that years ago created a second stock in the cataloginventory_stock table, and we also have a whole bunch of entries in the cataloginventory_stock_item table that references that second stock (id: 2)
When we upgrade this shop to Magento 2.4.6-p2 and enable the MSI modules, then running bin/magento setup:upgrade results in the following error:
...
layout: 1
block_html: 1
full_page: 1
Unable to apply data patch Magento\InventoryLowQuantityNotification\Setup\Patch\Data\MigrateCatalogInventoryNotifyStockQuantityData for module Magento_InventoryLowQuantityNotification. Original exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-KB001' for key 'PRIMARY', query was: INSERT INTO `inventory_low_stock_notification_configuration` (`source_code`, `sku`, `notify_stock_qty`) SELECT `source_item`.`source_code`, `source_item`.`sku`, `stock_item`.`notify_stock_qty` FROM `cataloginventory_stock_item` AS `stock_item`
INNER JOIN `catalog_product_entity` AS `product` ON product.entity_id = stock_item.product_id
INNER JOIN `inventory_source_item` AS `source_item` ON source_item.sku = product.sku WHERE (stock_item.use_config_notify_stock_qty = 0) AND (source_item.source_code = 'default')
So it sounds like this MigrateCatalogInventoryNotifyStockQuantityData patch can't deal with databases that have more then a single stock before MSI got installed.
Expected result (*)
No errors
Actual result (*)
See above
The text was updated successfully, but these errors were encountered:
Hi @hostep. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
Preconditions (*)
Steps to reproduce (*)
cataloginventory_stock
table, and we also have a whole bunch of entries in thecataloginventory_stock_item
table that references that second stock (id: 2)bin/magento setup:upgrade
results in the following error:Running the SELECT part of the query results in:
And indeed, there are 2 rows in
cataloginventory_stock_item
that correspond with this SKU (entity_id: 9158)So it sounds like this
MigrateCatalogInventoryNotifyStockQuantityData
patch can't deal with databases that have more then a single stock before MSI got installed.Expected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: