DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Laravel migration table field's type change

update: 31 Oct 2023, Still usable on laravel 10.x https://laravel.com/docs/10.x/migrations#modifying-columns

To make some change to existing db, you can modify column type by using change() in migration.

This is what you could do

Schema::table('orders', function ($table) {
    $table->string('category_id')->change()
});

please note you need to add doctrine/dbal dependency to composer.json

composer

Top comments (0)