magento-stock-movements
magento-stock-movements copied to clipboard
Upgrade from stock history to stock movement
I used the following SQL to upgrade from Stock History, because there didn't seem another way..
But I wonder if this is correct because I don't see the old history through products even though it is in the new table and looks correct.
Does is_admin need to be 1?
INSERT INTO mage_bubble_stock_movement
(
movement_id
,
item_id
,
user
,
user_id
,
is_admin
,
qty
,
is_in_stock
,
message
,
created_at
)
SELECT
sh.history_id
,
sh.item_id
,
sh.user
,
sh.user_id
,
0,
sh.qty
,
sh.is_in_stock
,
sh.message
,
sh.created_at
FROM mage_cataloginventory_stock_history
as sh
INNER JOIN mage_catalog_product_entity
as pm
ON sh.item_id = pm.entity_id