Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel table data types

$table->bigIncrements('id'); 	Incrementing ID using a "big integer" equivalent.
$table->bigInteger('votes'); 	BIGINT equivalent to the table
$table->binary('data'); 	BLOB equivalent to the table
$table->boolean('confirmed'); 	BOOLEAN equivalent to the table
$table->char('name', 4); 	CHAR equivalent with a length
$table->date('created_at'); 	DATE equivalent to the table
$table->dateTime('created_at'); 	DATETIME equivalent to the table
$table->decimal('amount', 5, 2); 	DECIMAL equivalent with a precision and scale
$table->double('column', 15, 8); 	DOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point
$table->enum('choices', array('foo', 'bar')); 	ENUM equivalent to the table
$table->float('amount'); 	FLOAT equivalent to the table
$table->increments('id'); 	Incrementing ID to the table (primary key).
$table->integer('votes'); 	INTEGER equivalent to the table
$table->longText('description'); 	LONGTEXT equivalent to the table
$table->mediumInteger('numbers'); 	MEDIUMINT equivalent to the table
$table->mediumText('description'); 	MEDIUMTEXT equivalent to the table
$table->morphs('taggable'); 	Adds INTEGER taggable_id and STRING taggable_type
$table->nullableTimestamps(); 	Same as timestamps(), except allows NULLs
$table->smallInteger('votes'); 	SMALLINT equivalent to the table
$table->tinyInteger('numbers'); 	TINYINT equivalent to the table
$table->softDeletes(); 	Adds deleted_at column for soft deletes
$table->string('email'); 	VARCHAR equivalent column
$table->string('name', 100); 	VARCHAR equivalent with a length
$table->text('description'); 	TEXT equivalent to the table
$table->time('sunrise'); 	TIME equivalent to the table
$table->timestamp('added_on'); 	TIMESTAMP equivalent to the table
$table->timestamps(); 	Adds created_at and updated_at columns
$table->rememberToken(); 	Adds remember_token as VARCHAR(100) NULL
->nullable() 	Designate that the column allows NULL values
->default($value) 	Declare a default value for a column
->unsigned() 	Set INTEGER to UNSIGNED
Comment

migration types in laravel

/*
|========================================================
| Common Migration Types in (for mySql) Laravel
|========================================================
*/
$table->bigIncrements('id'); 	Incrementing ID using a "big integer" equivalent.
$table->bigInteger('votes'); 	BIGINT equivalent to the table
$table->binary('data'); 	BLOB equivalent to the table
$table->boolean('confirmed'); 	BOOLEAN equivalent to the table
$table->char('name', 4); 	CHAR equivalent with a length
$table->date('created_at'); 	DATE equivalent to the table
$table->dateTime('created_at'); 	DATETIME equivalent to the table
$table->decimal('amount', 5, 2); 	DECIMAL equivalent with a precision and scale
$table->double('column', 15, 8); 	DOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point
$table->enum('choices', array('foo', 'bar')); 	ENUM equivalent to the table
$table->float('amount'); 	FLOAT equivalent to the table
$table->increments('id'); 	Incrementing ID to the table (primary key).
$table->integer('votes'); 	INTEGER equivalent to the table
$table->longText('description'); 	LONGTEXT equivalent to the table
$table->mediumInteger('numbers'); 	MEDIUMINT equivalent to the table
$table->mediumText('description'); 	MEDIUMTEXT equivalent to the table
$table->morphs('taggable'); 	Adds INTEGER taggable_id and STRING taggable_type
$table->nullableTimestamps(); 	Same as timestamps(), except allows NULLs
$table->smallInteger('votes'); 	SMALLINT equivalent to the table
$table->tinyInteger('numbers'); 	TINYINT equivalent to the table
$table->softDeletes(); 	Adds deleted_at column for soft deletes
$table->string('email'); 	VARCHAR equivalent column
$table->string('name', 100); 	VARCHAR equivalent with a length
$table->text('description'); 	TEXT equivalent to the table
$table->time('sunrise'); 	TIME equivalent to the table
$table->timestamp('added_on'); 	TIMESTAMP equivalent to the table
$table->timestamps(); 	Adds created_at and updated_at columns
$table->rememberToken(); 	Adds remember_token as VARCHAR(100) NULL
->nullable() 	Designate that the column allows NULL values
->default($value) 	Declare a default value for a column
->unsigned() 	Set INTEGER to UNSIGNED
Comment

laravel migration update table column type

Schema::table('users', function ($table) {
    $table->string('name', 50)->change();
});
We could also modify a column to be nullable:

Schema::table('users', function ($table) {
    $table->string('name', 50)->nullable()->change();
});
Comment

laravel migration column types

# nullableTimestamps()
## alias of the timestamps method
	$table->nullableTimestamps(0);

# nullableMorphs()
## The method is similar to the morphs method 
## however, the columns that are created will be "nullable":
	$table->nullableMorphs('taggable');

# nullableUuidMorphs()
## The method is similar to the uuidMorphs method
## however, the columns that are created will be "nullable":
    $table->nullableUuidMorphs('taggable');

# point()
## creates a POINT equivalent column:
    $table->point('position');

# polygon()
## creates a POLYGON equivalent column:
    $table->polygon('position');

# rememberToken()
## creates a nullable, VARCHAR(100) equivalent column 
## that is intended to store the current "remember me" authentication token:
    $table->rememberToken();

# set()
## creates a SET equivalent column with the given list of valid values:
    $table->set('flavors', ['strawberry', 'vanilla']);

# smallIncrements()
## creates an auto-incrementing UNSIGNED SMALLINT 
## equivalent column as a primary key:
    $table->smallIncrements('id');

# smallInteger()
## creates a SMALLINT equivalent column:
    $table->smallInteger('votes');

# softDeletesTz()
## adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column 
## with an optional precision (total digits). 
## This column is intended to store the deleted_at timestamp 
## needed for Eloquent's "soft delete" functionality:
    $table->softDeletesTz($column = 'deleted_at', $precision = 0);

# softDeletes()
## adds a nullable deleted_at TIMESTAMP 
## equivalent column with an optional precision (total digits). 
## This column is intended to store the deleted_at timestamp 
## needed for Eloquent's "soft delete" functionality:
    $table->softDeletes($column = 'deleted_at', $precision = 0);

# string()
## creates a VARCHAR equivalent column of the given length:
    $table->string('name', 100);

# text()
## creates a TEXT equivalent column:
    $table->text('description');

# timeTz()
## creates a TIME (with timezone) 
## equivalent column with an optional precision (total digits):
    $table->timeTz('sunrise', $precision = 0);

# time()
## creates a TIME equivalent column with an optional precision (total digits):
    $table->time('sunrise', $precision = 0);

# timestampTz()
## creates a TIMESTAMP (with timezone) 
## equivalent column with an optional precision (total digits):
    $table->timestampTz('added_at', $precision = 0);

# timestamp()
## creates a TIMESTAMP equivalent column 
## with an optional precision (total digits):
    $table->timestamp('added_at', $precision = 0);

# timestampsTz()
## creates created_at and updated_at TIMESTAMP 
## (with timezone) equivalent columns with an optional precision (total digits):
    $table->timestampsTz($precision = 0);

# timestamps()
## creates created_at and updated_at TIMESTAMP 
## equivalent columns with an optional precision (total digits):
    $table->timestamps($precision = 0);

# tinyIncrements()
## creates an auto-incrementing UNSIGNED TINYINT 
## equivalent column as a primary key:
    $table->tinyIncrements('id');

# tinyInteger()
## creates a TINYINT equivalent column:
    $table->tinyInteger('votes');

# tinyText()
## creates a TINYTEXT equivalent column:
    $table->tinyText('notes');

# unsignedBigInteger()
## creates an UNSIGNED BIGINT equivalent column:
    $table->unsignedBigInteger('votes');

# unsignedDecimal()
## creates an UNSIGNED DECIMAL equivalent column with 
## an optional precision (total digits) 
## and scale (decimal digits):
    $table->unsignedDecimal('amount', $precision = 8, $scale = 2);

# unsignedInteger()
## creates an UNSIGNED INTEGER equivalent column:
    $table->unsignedInteger('votes');

# unsignedMediumInteger()
## creates an UNSIGNED MEDIUMINT equivalent column:
    $table->unsignedMediumInteger('votes');

# unsignedSmallInteger()
## creates an UNSIGNED SMALLINT equivalent column:
    $table->unsignedSmallInteger('votes');

# unsignedTinyInteger()
## creates an UNSIGNED TINYINT equivalent column:
    $table->unsignedTinyInteger('votes');

# uuidMorphs()
## The uuidMorphs method is a convenience method that adds a 
## {column}_id CHAR(36) equivalent column and a {column}_type 
## VARCHAR equivalent column.
## This method is intended to be used when defining the columns necessary 
## for a polymorphic Eloquent relationship that use UUID identifiers. 
## In the following example, `taggable_id` and `taggable_type` columns would be created:
    $table->uuidMorphs('taggable');

# uuid()
## creates a UUID equivalent column:
    $table->uuid('id');

# year()
## creates a YEAR equivalent column:
    $table->year('birth_year');
Comment

number data type in laravel migration

laravel migration types
Comment

data types of laravel migrations

select count(*) as aggregate from `categories` where `title` = jncisudrf
Comment

laravel Database migrations column types

$table->geometry('positions');
$table->ipAddress('visitor');
$table->macAddress('device');
$table->point('position');
$table->uuid('id');
Comment

PREVIOUS NEXT
Code Example
Php :: codeigniter last insert id 
Php :: date_default_timezone_set india 
Php :: print all session variables php 
Php :: php get referrer 
Php :: php check if file is video 
Php :: open php.ini in ubuntu 
Php :: Syntax error or access violation: 1071 La clé est trop longue. Longueur maximale: 1000 
Php :: if any comma in string in php 
Php :: date php 
Php :: get current url in codeigniter 
Php :: laravel favicon 
Php :: laravel keep old input 
Php :: php get subdomain 
Php :: hide .php from url .htaccess 
Php :: install php 7.4 on ubuntu 20.04 
Php :: laravel blade errors all 
Php :: error log php array 
Php :: first character uppercase php 
Php :: eloquent run seeder 
Php :: laravel 8 delete by id 
Php :: codeigniter get where 
Php :: htaccess set php memory limit 
Php :: php console output 
Php :: php self submit 
Php :: check table exists in db laravel 
Php :: get the current page id in wordpress 
Php :: php artisan ui auth 
Php :: wp+get feature image 
Php :: laravel collection shuffle 
Php :: php ping test 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =