1

How to declare int length in Magento 2.4 db_schema file?

3 Answers 3

1

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

https://dev.mysql.com/doc/refman/8.0/en/integer-types.html

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

0

You can use this link. This explains your need.

https://developer.adobe.com/commerce/php/development/components/declarative-schema/configuration/

0

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, privacy policy and cookie policy

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