修改字段 运行 php artisan migrate 报错

1. 运行环境

1). 当前使用的 Laravel 版本?

Laravel Framework 5.8.38

2). 当前使用的 php/php-fpm 版本?

PHP 版本:

PHP 7.3.24 (cli)

php-fpm 版本:

PHP 7.3.11 (fpm-fcgi)

3). 当前系统

Mac

2. 问题描述?

执行 php artisan migrate 报错

<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class UpdateOrderProGModelTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('order_pros', function (Blueprint $table) { $table->longText('g_name')->comment('商品名称')->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { } }

3. 得到的结果?

修改字段 运行 php artisan migrate 报错

chenxxx@MacBook-Pro cusdecsys % php artisan migrate Migrating: 2021_12_24_111101_update_order_pro_g_model_table PDOException : SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances at /Users/chenweile/Code/cusdecsys/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:209 205| throw Exception::invalidPdoInstance(); 206| } 207| 208| $this->_conn = $params['pdo']; > 209| $this->_conn->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDODriverStatement::class, []]); 210| unset($this->params['pdo']); 211| } 212| 213| if (isset($params['platform'])) { Exception trace: 1 PDO::setAttribute() /Users/chenweile/Code/cusdecsys/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:209 2 Doctrine\DBAL\Connection::__construct([Object(PDO), "test_dhcds", "pdo_mysql"], Object(Doctrine\DBAL\Driver\PDOMySql\Driver)) /Users/chenweile/Code/cusdecsys/vendor/laravel/framework/src/Illuminate/Database/Connection.php:900 Please use the argument -v to see more details.

4.备注

已经安装好依赖(如下图),并且项目已经运行了几年,其中也有多次更新迭代,也有修改字段的

修改字段 运行 php artisan migrate 报错

一个路过的小白
chenvle
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 5
你看我吊吗啊

换一下数据类型longText 或者换字段名试试

3年前 评论
chenvle (楼主) 3年前
chenvle

:joy:有解决方法吗

3年前 评论

我今天突然也碰到了类似的问题,一直用的好好的,今天提示Class 'Doctrine\Common\EventManager' not found

2年前 评论
wanglong126 (作者) 2年前