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
  1. 关于laravel renameColumn 更改字段报错
  2. [Bug] Schema builder - renameColumn fails on table with enum columns

最新文章

  1. qt 定时器
  2. JS实战 · 仿css样式选择器
  3. sublime插件@sublimelinter安装使用
  4. Swagger-UI 基于REST的API测试/文档类插件
  5. Python核心编程--学习笔记--1--Python简介
  6. Solr Schema.xml和solrconfig.xml分析(转)
  7. LinkedList类
  8. 手机自动化测试:appium源码分析之bootstrap十
  9. sqoop的导入导出
  10. obj-c编程11:内存管理和ARC(自动引用计数)
  11. JavaMap的一些常用方法
  12. 六、APP开发的主角——UIViewController
  13. 【发布iCore3&iCore4ADM资料】
  14. 通过Metasploit生成各种后门
  15. python 判断字符串是字母 数字 大小写还是空格
  16. 001_nginx常用参数查询
  17. 两张图看清SharePoint 2013 Farm 逻辑体系结构
  18. hadoop hdfs 命令
  19. JSP页面实现自动跳转
  20. pip 解决 ImportError: cannot import name 'main'

热门文章

  1. byte为什么要与0xff
  2. Android消息处理:EventBus、BroadCast和Handler-优缺点比较
  3. shell脚本 set命令
  4. RRT路径规划算法(matlab实现)
  5. Github上发布托管和下载
  6. BZOJ 1927: [Sdoi2010]星际竞速(费用流)
  7. python:列表、元组和字典
  8. Go语言中接口组合的实现方法
  9. C++的ofstream与ifstream使用
  10. ASP.NET CORE-Info:TechEmpower最新一轮的性能测试出炉,ASP.NET Core依旧表现不俗