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. 如何在web项目中配置Spring的Ioc容器

    在web项目中配置Spring的Ioc容器其实就是创建web应用的上下文(WebApplicationContext) 自定义要使用的IoC容器而不使用默认的XmlApplicationContext ...

  2. System.Web.Mvc 4.0.0.1 和 4.0.0.0 区别

    只是一个安全补丁的问题:  http://www.microsoft.com/zh-cn/download/details.aspx?id=44533&WT.mc_id=rss_alldown ...

  3. 学习笔记-es5新增的一些数组的API(不全)-字符串-字符串API(不全)

    ### es5新增的数组的api + indexOf() 搜索数组中的元素,并返回它所在的位置. arr.indexOf(str,index) 参数: str为要查找的字符串 index为开始查找的下 ...

  4. shell只读变量

  5. shell date 格式化

    https://www.tutorialkart.com/bash-shell-scripting/bash-date-format-options-examples/ DATE=`date '+%d ...

  6. redis集群添加新节点

    一.创建节点(接上文) 1.在H1服务器/root/soft目录下创建7002目录 2.将7001目录的配置文件redis.conf拷贝到7002,并修改配置文件的端口 3.进入 redis-5.0. ...

  7. safari浏览器中获取指定时间的毫秒数

    最近在项目中,发现时间转换,在firefox和chrome中可以正确的显示,但是在Safari中显示NaN.在网上查了下,发现Safari不支持 YYYY-MM-DD HH:MM:SS 这个时间格式, ...

  8. 对于异步编程Await和Async的理解

    public class AsyncInSync { /// <summary> /// 同步代码里有异步代码 /// /// /// 结果 /// Main Thread Before ...

  9. 【leetcode】949. Largest Time for Given Digits

    题目如下: Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 ...

  10. mobx中使用class语法或decorator修饰器时报错

    之前课程中老师用的babel的版本比较低,我在学习时安装的babel版本较高,因此每当使用class语法或decorator修饰器时都会出现一些报错的情况! ❌ ERROR in ./src/inde ...