Laravel migrations change a column type from varchar to longText

前端 未结 5 1945
野性不改
野性不改 2021-02-02 06:49

I need to change with migration column type of $table->string(\'text\'); to a text type, I have tried to do that in few ways, but none of them worked. Is it poss

5条回答
  •  孤城傲影
    2021-02-02 07:47

    You can create a new migration and change just one column type:

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

    You need to install doctrine/dbal to make this work

    composer require doctrine/dbal
    

    Works with Laravel 5.0+. It does not work with Laravel 4.2.

提交回复
热议问题