gpt4 book ai didi

php - 使用 Doctrine DBAL 使用 laravel 迁移更改列类型会出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:02:27 31 4
gpt4 key购买 nike

我使用 Laravel 5.2、Php7、Apache、Windows

我的迁移文件是“2016_03_30_095234_alter_date_update_news_table.php”

class AddSlugUpdateNewsTable extends Migration
{
/**
* Run the migrations.
* php artisan make:migration add_slug_update_news_table
* @return void
*/
public function up()
{
Schema::table('news', function (Blueprint $table) {
$table->date('slug')->change();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('news', function (Blueprint $table) {
$table->dateTime('slug')->change();
});
}
}

但是在运行 migrate 之后,

$\> php artisan 迁移

给我这个错误!

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

我该怎么办?

最佳答案

根据 laravel docs .如果您使用->change() 函数,您必须先安装doctrine/dbal

在你的终端输入composer require doctrine/dbal

关于php - 使用 Doctrine DBAL 使用 laravel 迁移更改列类型会出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36312594/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com