“Actualizar la migración de Laravel tipo columna” Código de respuesta

Tipo de columna de cambio de laravel

php artisan make:migration change_sometable_in_finance_table --table=finance

public function up()
{
    Schema::table('sometable', function (Blueprint $table) {
        $table->text('text')->change();
    });
}
Excited Echidna

Tipo de columna de cambio de migración de Laravel

public function up()
{
    Schema::table('sometable', function (Blueprint $table) {
        $table->text('text')->change();
    });
}
hmt

Tipo de columna de la tabla de actualización de migración de Laravel

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();
});
Shadow

Actualizar la migración de Laravel tipo columna

$table-><column_type>('<column_name>')->change();
Shadowtampa

tipos de columna de migración de Laravel

# 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');
Scary Shark

Respuestas similares a “Actualizar la migración de Laravel tipo columna”

Preguntas similares a “Actualizar la migración de Laravel tipo columna”

Más respuestas relacionadas con “Actualizar la migración de Laravel tipo columna” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código