[
32
]
Laravel offers the following methods for defining migrations:
Command
Description
$table->bigIncrements('name');
It creates an auto-incrementing big integer
column
$table->bigInteger('name');
It creates a BIGINT column
$table->binary('name');
It creates a BLOB column
$table->boolean('active');
It creates a BOOLEAN column
$table->char('name', 8);
It creates a CHAR column with the given length
$table->date('birthdate');
It creates a DATE column
$table->dateTime('created_at');
It creates a DATETIME column
$table->decimal('amount', 5,
2);
It creates a DECIMAL column with the given
precision and scale
$table->double('column', 10,
5);
It creates a DOUBLE column, with 10 digits in
total and 5 after the decimal point
$table->enum('gender',
['Female', 'Male']);
It creates an ENUM column
$table->float('amount');
It creates a FLOAT column
$table->increments('id');
It creates an auto-incrementing integer column
$table->integer('rating');
It creates an INTEGER column
$table->json('options');
It creates a JSON column
$table->longText('description');
It creates a LONGTEXT column
$table->mediumInteger('name');
It creates a MEDIUMINT column
$table->mediumText('name');
It creates a MEDIUMTEXT column
$table->morphs('taggable');
It creates two columns: INTEGER taggable_
id
and STRING taggable_type
Do'stlaringiz bilan baham: |