Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing column in Laravel migration causes exception: Changing columns for table requires Doctrine DBAL

I'm trying to change the max length of one of my columns in table reserves in one migration. The code looks like this:

public function up()
{
    //
    Schema::table('reserves', function($table){
        $table->string("mobile", 11)->change();
    });
}

But when running the migration via artisan, it throws an exception and says:

[RuntimeException] Changing columns for table "reserves" requires Doctrine DBAL; install "doctrine/dbal".

What is the problem and how can I solve it?

like image 477
Ahmad Avatar asked Apr 21 '16 21:04

Ahmad


2 Answers

The problem was solved by executing the following command on the root directory of the framework:

composer require doctrine/dbal
like image 194
Ahmad Avatar answered Nov 06 '22 07:11

Ahmad


add to composer.json

"require": {
        ...
        "doctrine/dbal": "*"
    },

run "composer update" command

like image 3
majid mohammadian Avatar answered Nov 06 '22 07:11

majid mohammadian