during setup:upgrade get an error

Module 'Magento_PurchaseOrder':

Unable to apply data patch Magento\PurchaseOrder\Setup\Patch\Data\InitPurchaseOrderSalesSequence for module Magento_PurchaseOrder. Original exception message: DDL statements are not allowed in transactions

  • did you tried to manually delete generated folder and then run di:compile and then s:up?
    – Pramod
    Aug 3, 2020 at 4:08

2 Answers 2


DDL statements won't work in setup patch because now you need to use declarative schema(db_schema.xml) to run DB queries (i.e, table creation).

Reference: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/declarative-schema/

  • Considering this is an error in a Magento module. The error must be in a different place
    – Matias
    Aug 7, 2020 at 13:41

You have to update your Magento B2B module, you can use these commands below, but first, change the composer.json to have the most updated version.

"magento/extension-b2b": "^1.2",

Then run:

composer update -vvv
bin/magento setup:upgrade
bin/magento cache:enable
bin/magento setup:static-content:deploy -f
bin/magento setup:di:compile
bin/magento maintenance:disable
  • Hi @Rafael Thank you for the answer. I changed the b2b version in my setup and run composer update. but it shows no new updates. and I run setup:upgrade command the issue is not resolved. Aug 6, 2020 at 9:18
  • This doesn't work...
    – Matias
    Aug 7, 2020 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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