How to declare int length in Magento 2.4 db_schema file?

3 Answers 3


Can you explain what is reason to set length of int column?

The int uses 4 bytes (32 bits) and can be unsigned with range from 0 to 4294967295 and signed with range from -2147483648 to 2147483647


MySQL will store the value regardless from length value, the length affect to formatter (padding length) in console and when set ZEROFILL option.


You can use this link. This explains your need.



You can use padding="10" to define the size of int in db_schema.xml

<column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>

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.