Laravel Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
2024-09-08 14:19:08
Laravel: 5.5.*
在迁移中有重命名操作的时候,运行 php artisan migrate
会提示 Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
的错误信息,
可通过composer 安装 doctrine/dbal
类库,然后运行 迁移就可以了
修改 表字段的 enum
值时,使用DB::statement()
方法进行修改字段的ENUM值
migration 文件中有以下代码:
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'social')) {
$table->enum('social',[
'weibo',
'zhihu',
'qq'
])->default('weibo')->index()->change();
}
});
运行 php artisan migrate
显示以下错误信息:
In AbstractPlatform.php line 434:
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
migration 改为:
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'social')) {
DB::statement("ALTER TABLE users MODIFY COLUMN social ENUM('weibo','zhihu','qq')");
}
});
然后运行php artisan migrate
就可以修改到 用户表中的social
的 enum 值
Reference
最新文章
- qt 定时器
- JS实战 · 仿css样式选择器
- sublime插件@sublimelinter安装使用
- Swagger-UI 基于REST的API测试/文档类插件
- Python核心编程--学习笔记--1--Python简介
- Solr Schema.xml和solrconfig.xml分析(转)
- LinkedList类
- 手机自动化测试:appium源码分析之bootstrap十
- sqoop的导入导出
- obj-c编程11:内存管理和ARC(自动引用计数)
- JavaMap的一些常用方法
- 六、APP开发的主角——UIViewController
- 【发布iCore3&;iCore4ADM资料】
- 通过Metasploit生成各种后门
- python 判断字符串是字母 数字 大小写还是空格
- 001_nginx常用参数查询
- 两张图看清SharePoint 2013 Farm 逻辑体系结构
- hadoop hdfs 命令
- JSP页面实现自动跳转
- pip 解决 ImportError: cannot import name 'main'
热门文章
- byte为什么要与0xff
- Android消息处理:EventBus、BroadCast和Handler-优缺点比较
- shell脚本 set命令
- RRT路径规划算法(matlab实现)
- Github上发布托管和下载
- BZOJ 1927: [Sdoi2010]星际竞速(费用流)
- python:列表、元组和字典
- Go语言中接口组合的实现方法
- C++的ofstream与ifstream使用
- ASP.NET CORE-Info:TechEmpower最新一轮的性能测试出炉,ASP.NET Core依旧表现不俗