Laravel migration change column type

2024-03-04 04:38:12 Khushi Laravel

How to change column type in Laravel Migration

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.


public function up()
  Schema::table('sometable', function (Blueprint $table) {

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.

Related Tricks