I'm setting up a migration on Laravel 5 and was wondering if there was some documentation for the default lengths of each of the Column Types ? Do they follow some convention like MySQL's?
Ex: INTEGER, TEXT, MEDIUMTEXT, LONGTEXT
I'm talking about these Column Types : (http://laravel.com/docs/5.0/schema#adding-columns)
In our case we are going to do second option - create new migration. If we roll back this migration, we need to remove default value from that field using migration and this is how to do it: Schema::table('photos', function (Blueprint $table) { $table->integer('order')->default(NULL)->change(); });
CHAR - 1 to 191
(trailing spaces removed)
STRING - 1 to 16,300
(user defined)
TEXT - 1 to 65,535
MEDIUMTEXT - 1 to 16,777,215
LONGTEXT - 1 to 4,294,967,295
TINYINT - 0 to 255
(unsigned) | -128 to 127
(signed)
SMALLINT - 0 to 65,535
(unsigned) | -32,768 to 32,767
(signed)
MEDIUMINT - 0 to 16,777,215
(unsigned) | -8,388,608 to 8,388,607
(signed)
INT - 0 to 4,294,967,295
(unsigned) | -2,147,483,648 to 2,147,483,647
(signed)
BIGINT - 0 to 18,446,744,073,709,551,615
(unsigned) | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
(signed)
FLOAT - ([0-7], [0-23])
DOUBLE - ([0-14], [24-53])
DECIMAL - ([0-65], [0-30])
Note: decimal stores exact value when we print it in INT. See example below:
DOUBLE = DECIMAL = 2.65
//convert it to int
DOUBLE = 2
DECIMAL = 3
See all column type for laravel: documentation
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