1

I have upgraded Magento from 2.2.5 to 2.3.1 using composer. Everything downloaded. While running setup: upgrade, I got an error like below,

I checked with the previous version there is decimal version changed in 2.3.x. Any idea why this error?

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (vv.#sql-4a2b_1b18, CONSTRAINT QUOTE_ITEM_QUOTE_ID_QUOTE_ENTITY_ID FOREIGN KEY (quote_id) REFERENCES quote (entity_id) ON DELETE CASCADE), query was: ALTER TABLE quote_item MODIFY COLUMN discount_amount decimal(20, 4) NULL DEFAULT 0 COMMENT "Discount Amount", MODIFY COLUMN base_discount_amount decimal(20, 4) NULL DEFAULT 0 COMMENT "Base Discount Amount", MODIFY COLUMN tax_amount decimal(20, 4) NULL DEFAULT 0 COMMENT "Tax Amount", MODIFY COLUMN base_tax_amount decimal(20, 4) NULL DEFAULT 0 COMMENT "Base Tax Amount", MODIFY COLUMN row_total decimal(20, 4) NOT NULL DEFAULT 0 COMMENT "Row Total", MODIFY COLUMN base_row_total decimal(20, 4) NOT NULL DEFAULT 0 COMMENT "Base Row Total", MODIFY COLUMN row_total_with_discount decimal(20, 4) NULL DEFAULT 0 COMMENT "Row Total With Discount", MODIFY COLUMN base_tax_before_discount decimal(20, 4) NULL COMMENT "Base Tax Before Discount", MODIFY COLUMN tax_before_discount decimal(20, 4) NULL COMMENT "Tax Before Discount", MODIFY COLUMN price_incl_tax decimal(20, 4) NULL COMMENT "Price Incl Tax", MODIFY COLUMN base_price_incl_tax decimal(20, 4) NULL COMMENT "Base Price Incl Tax", MODIFY COLUMN row_total_incl_tax decimal(20, 4) NULL COMMENT "Row Total Incl Tax", MODIFY COLUMN base_row_total_incl_tax decimal(20, 4) NULL COMMENT "Base Row Total Incl Tax", MODIFY COLUMN discount_tax_compensation_amount decimal(20, 4) NULL COMMENT "Discount Tax Compensation Amount", MODIFY COLUMN base_discount_tax_compensation_amount decimal(20, 4) NULL COMMENT "Base Discount Tax Compensation Amount", ADD CONSTRAINT QUOTE_ITEM_PARENT_ITEM_ID_QUOTE_ITEM_ITEM_ID FOREIGN KEY (parent_item_id) REFERENCES quote_item (item_id) ON DELETE CASCADE, ADD CONSTRAINT QUOTE_ITEM_QUOTE_ID_QUOTE_ENTITY_ID FOREIGN KEY (quote_id) REFERENCES quote (entity_id) ON DELETE CASCADE, ADD CONSTRAINT QUOTE_ITEM_STORE_ID_STORE_STORE_ID FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE SET NULL

0

just doing one thing you can divide query in 2 parts and execute. first Alter Table query and the second is apply foreign key manual so it's working

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.