In this trick we will see how to change column data type for example we are going to change a field from varchar to longText. To do this create a new migration file and add below code and run that migration.
Example:
public function up()
{
Schema::table('sometable', function (Blueprint $table) {
$table->text('text')->change();
});
}
Command to run single migration
php artisan migrate --path=/database/migrations/your_migration.php
This post is submitted by one of our members. You may submit a new post here.
Laravel interview Questions © 2019 - Designed by PSD to HTML