Error - setup:upgrade
Closed this issue · 6 comments
When I exec:
php bin/magento setup:upgrade
Console returns:
SQLSTATE[42000]: Syntax error or access violation: 1235 This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table', query was: CREATE TRIGGER stock_after_insert AFTER INSERT ON cataloginventory_stock_item FOR EACH ROW
BEGIN
DECLARE isEnable SMALLINT(5);
SELECT 1 INTO isEnable FROM core_config_data WHERE path = 'inventory_log/general/inventory_enabled' and value = 1;
IF (isEnable = 1) THEN
IF (NEW.qty IS NOT NULL) THEN
IF (NEW.ukey IS NULL) THEN
INSERT INTO kiwicommerce_stock_movement(stock_item_id,product_id,current_qty,qty_movement,old_qty,is_in_stock,message,ukey) VALUES (NEW.item_id,NEW.product_id,NEW.qty,NEW.qty,0,NEW.is_in_stock,"Stock updated by direct query Insert",NEW.ukey);
END IF;
END IF;
END IF;
END
Hi @kauansoft
Thanks for reporting the issue.
We will check it and back to you.
Hi @kauansoft
Thank you for your report. Unfortunately I'm not able to reproduce this issue locally.
Could you please provide more detailed steps to reproduce?
Screenshot: https://www.screencast.com/t/xutoXiyDKQk
Thank you.
To reproduce this issue you have to set index to schedule mode:
php bin/magento indexer:set-mode schedule
We're facing this issue aswel; we're using MySQL Ver 14.14 Distrib 5.6.37-82.2, for debian-linux-gnu (x86_64) using 6.3
Had this issue on certain environments and not others. Looks like it has to do with the version of MySQL/MariaDB allowing multiple triggers for the same table/event/time. For MySQL, any version prior to 5.7.2 only allows one trigger per table/event/time, and the cataloginventory_stock_item already has a trigger named "trg_cataloginventory_stock_item_after_insert" on the same table/event/time as the "stock_after_insert" trigger created by this module. I'm not entirely sure where the existing trigger came from or what it does. Unfortunately for me, our site is on Magento Cloud so we have no control over the db version :(
I just installed fresh instance of Magento CE 2.3.3 and on setup upgrade (bin/magento s:up) got same error on windows.
Magento version:
CE 2.3.3
PHP version:
PHP 7.2.11
MySQL version:
Server version: 10.1.36-MariaDB mariadb.org binary distribution
and trigger is defined in Magento Module:
Magento_GoogleShoppingAds
Table:
cataloginventory_stock_item
Statement:
BEGIN
INSERT IGNORE INTO `scconnector_google_feed_cl` (`entity_id`) VALUES (NEW.`product_id`);
END
Timing:
AFTER
Table:
cataloginventory_stock_item
Statement:
BEGIN
IF (NEW.`item_id` <=> OLD.`item_id` OR NEW.`product_id` <=> OLD.`product_id` OR NEW.`stock_id` <=> OLD.`stock_id` OR NEW.`qty` <=> OLD.`qty` OR NEW.`min_qty` <=> OLD.`min_qty` OR NEW.`use_config_min_qty` <=> OLD.`use_config_min_qty` OR NEW.`is_qty_decimal` <=> OLD.`is_qty_decimal` OR NEW.`backorders` <=> OLD.`backorders` OR NEW.`use_config_backorders` <=> OLD.`use_config_backorders` OR NEW.`min_sale_qty` <=> OLD.`min_sale_qty` OR NEW.`use_config_min_sale_qty` <=> OLD.`use_config_min_sale_qty` OR NEW.`max_sale_qty` <=> OLD.`max_sale_qty` OR NEW.`use_config_max_sale_qty` <=> OLD.`use_config_max_sale_qty` OR NEW.`is_in_stock` <=> OLD.`is_in_stock` OR NEW.`low_stock_date` <=> OLD.`low_stock_date` OR NEW.`notify_stock_qty` <=> OLD.`notify_stock_qty` OR NEW.`use_config_notify_stock_qty` <=> OLD.`use_config_notify_stock_qty` OR NEW.`manage_stock` <=> OLD.`manage_stock` OR NEW.`use_config_manage_stock` <=> OLD.`use_config_manage_stock` OR NEW.`stock_status_changed_auto` <=> OLD.`stock_status_changed_auto` OR NEW.`use_config_qty_increments` <=> OLD.`use_config_qty_increments` OR NEW.`qty_increments` <=> OLD.`qty_increments` OR NEW.`use_config_enable_qty_inc` <=> OLD.`use_config_enable_qty_inc` OR NEW.`enable_qty_increments` <=> OLD.`enable_qty_increments` OR NEW.`is_decimal_divided` <=> OLD.`is_decimal_divided` OR NEW.`website_id` <=> OLD.`website_id`) THEN INSERT IGNORE INTO `scconnector_google_feed_cl` (`entity_id`) VALUES (NEW.`product_id`); END IF;
END
Timing:
AFTER
Table:
cataloginventory_stock_item
Statement:
BEGIN
INSERT IGNORE INTO `scconnector_google_feed_cl` (`entity_id`) VALUES (OLD.`product_id`);
END
Timing:
AFTER
In my case I am not using Magento_GoogleShoppingAds module, so I disabled it and then tried bin/magento s:up and it worked.