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

Laravel Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found的更多相关文章

  1. 解决laravel Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found 错误

    这个错误的原因来自于没有安装一个依赖库: 官方文档说明如下: Modifying Columns Prerequisites Before modifying a column, be sure to ...

  2. composer安装doctrine/dbal

    composer安装doctrine/dbal composer安装doctrine/dbal,安装不成功,使用的安装命令为官方提供命令“composer require doctrine/dbal” ...

  3. Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class

    Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb ...

  4. Eclipse中使用MySql遇到:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading o

    在Eclipse中使用MySQL遇到了点小问题 如果对Eclipse中配置MySql还有疑问的可以参考一下这篇博客:https://blog.csdn.net/qq_38247544/article/ ...

  5. 安装Chrome driver/ IE driver

    2014-08-15 11:38 22100人阅读 评论(0) 收藏 举报  分类: python基础学习(97)  >>>安装Chrome driver chrome driver ...

  6. [platform]linux platform device/driver(一)--Driver是如何找到对应的device

    1.platform device是怎么"自动"关联到platform driver上的? 转向linux driver有些时间了,前段时间碰到个问题,在Linux kernel ...

  7. spingboot启动报驱动Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of th

    原因: springboot应用了最新的驱动com.mysql.cj.jdbc.Driver,这个驱动需要用mysql-connector-java包的6.x版本才可以, 而mysql-connect ...

  8. Windows Driver Foundation-User-Mode Driver Framework 服务不能启动(错误31)问题解决

    这个错误是由于WudfPf这个服务没有启动有关,导致开机时出现SVCHOST.EXE出现,内存不能"Written"的错误, http://answers.yahoo.com/qu ...

  9. NetBeans IDE驱动报错The path to the driver executable must be set by the web driver.chrome.driver.system property......

    问题:defaulstUserDataPath=C:\\Users\\user1\\AppData\\Local\\Google\\Chrome\\User Data\\Defaul 编译失败 解决 ...

随机推荐

  1. 解决code first Migration 增加外键时出现错误的问题

    先上模型 Comment public class Comment { [Key] public int CommentId { get; set; } [Required] public int S ...

  2. RPC协议的介绍

    根据网上搜索的一些资料摘抄汇总的,如果有误,欢迎斧正. 早期单机时代,一台电脑上运行多个进程,大家各干各的,老死不相往来.假如A进程需要一个画图的功能,B进程也需要一个画图的功能,程序员就必须为两个进 ...

  3. Shell内置命令let

  4. OpenGL学习——绘制第一个三角形

    终于把三角形绘制出来了,首先一些关键概念.操作. Vertex Data                       顶点数据 VBO Vertex Buffer Objects  顶点缓冲对象 VA ...

  5. readme.md常用格式的编写

    md是Markdown的缩写,md是一种易读易写的文本格式(easy-to-read, easy-to-write plain text format),并且可以很方便的转换成HTML格式显示在网页中 ...

  6. Tomcat启动后中文乱码,怎么解决这个问题

    今天很疑惑这个问题,于是去网上找了答案,结果是需要修改Tomcat根目录下面的"logging.properties"文件,把所有的encoding=UTF-8的改成encodng ...

  7. QDomDocument::clear()的调用,会导致关闭程序时崩溃!!!

    //读一份xml前,先清理m_Doc[QDomDocument] bool XmlIO::xmlRead(QString &errmsg) { m_mutex.lock(); // m_Doc ...

  8. C存储类

    C 存储类 存储类定义 C 程序中变量/函数的范围(可见性)和生命周期.这些说明符放置在它们所修饰的类型之前.下面列出 C 程序中可用的存储类: auto register static extern ...

  9. 【Redis】分布式锁RedLock

    普通实现 说道Redis分布式锁大部分人都会想到: 1.setnx+lua, 2.setkey value px milliseconds nx. - 获取锁(unique_value可以是UUID等 ...

  10. kubernetes(k8s)集群安全机制RBAC

    1.基本概念 RBAC(Role-Based Access Control,基于角色的访问控制)在k8s v1.5中引入,在v1.6版本时升级为Beta版本,并成为kubeadm安装方式下的默认选项, ...