Why does Laravel create the integer column as INT(11) and unsigned integer column as INT(10)?
$table->integer('integer'); // INT(11)
$table->unsignedInteger('unsignedInteger'); // INT(10) unsigned
$table->integer('integer_then_unsigned')->unsigned(); // INT(10) unsigned
Since the unsigned integers maximum value can be almost twice as large, shouldn't it rather be the other way around?
Because of the minus sign when integer can be signed.
Unsigned integers will have 10 digits, and its display length is therefore - 10.
Signed integers will require a space for the minus sign, if it's negative. Therefore, on top of 10 digits, you need another one for the sign.
It is because the minus sign in case your column is signed, which allows the field to have negative integers. You can have up to 10 digits when your field is unsigned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With