I'm new to Magento. I want to store 3rd party order id and customer id in column ext_order_id and ext_customer_id in table sales_order.

The problem is these 2 columns have length 32, so I altered the table to set it to 50. However, every time I ran command bin/magento setup:upgrade, the column length was reset back to 32, and data in that column was truncated.

Any solution to store 50 characters in those columns? Thanks

  • How have you added two field? directly on table or using script? Oct 3, 2021 at 11:35
  • @SweetyMasmiya these 2 columns (ext_order_id and ext_customer_id) are default columns of table sales_order, they are there at beginning, I didn't add them Oct 3, 2021 at 13:33

1 Answer 1


create a db_schema.xml in a module of yours and update it there example here: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/declarative-schema/db-schema.html

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.