I need to change with a migration column type of $table->string('text'); to a text type, I have tried to do that in a few ways, but none of them worked. Is it possible to do it in one migration? I could I guess drop the column and then create it again with a new type, but I wonder if it is possible to do it in one migration?

推荐答案

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.

Laravel相关问答推荐

Laravel FAKER语法

Uncaught ReferenceError:未定义require[Shopify PHP React Browser问题]

验证判断请求的值是否存在于另一个表 Laravel 9 中

如何在自定义表单请求中获取错误验证数据

导出所有客户端不起作用,文件保存时没有名称和扩展名

当使用Laravel eloquent查询100000条数据时速度很慢

Laravel,没有shell 访问的转储自动加载

Laravel 5.3 创建模型返回字段没有默认值

在Laravel 5中通过ID和所有递归获取记录

Laravel 5.4 LengthAwarePaginator

Laravel 5 - 在控制器文件中为多个路由定义中间件

Laravel - 批量分配异常错误

如何在 Laravel 5 中验证当前、新密码和新密码确认?

PHP Laravel:如何获取客户端浏览器/设备?

如何使用 Laravel 测试授权重定向?

获取多列字段?

如何卸载 Laravel Passport

Laravel homestead IP地址不起作用

Laravel Route 模型与关系绑定

在 Laravel 中翻译特定语言