laravel 工匠迁移错误“找不到类‘Doctrine\\DBAL\\Driver\\PDOMySql\\Driver’”,
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33817983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
artisan migration error "Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found",
提问by Nancymic
When trying to run a migration I get the error Artisan migration
尝试运行迁移时,我收到错误 Artisan 迁移
error:
Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found
错误:
Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found
I have read the questions here and also see the notes to add:
我已经阅读了这里的问题,也看到了要添加的注释:
doctrine/dbal": "~2.3
in the requires section of composer.json
doctrine/dbal": "~2.3
在 composer.json 的 requires 部分
However, I don't understand what has happened. I created table a few days ago with no issue.
但是,我不明白发生了什么。几天前我创建了表,没有问题。
I can't figure out what to do after adding that dependency in composer.son.
在 composer.son 中添加该依赖项后,我不知道该怎么做。
I don't want to accidentally update any other packages.
我不想意外更新任何其他软件包。
回答by Mahbub
doctrine/dbal
dependency need be added to your composer.json
doctrine/dbal
需要将依赖项添加到您的 composer.json
composer require doctrine/dbal
For more information check laravel #Modifying Columns
有关更多信息,请查看laravel #Modifying Columns
回答by Tarek Mesalam
This message shows up if you want to edit column in a database.
如果您要编辑数据库中的列,则会显示此消息。
To solve it do:
要解决它,请执行以下操作:
- add
doctrine/dbal
dependency tocomposer.json
- and use the
composer require doctrine/dbal
command
- 添加
doctrine/dbal
依赖composer.json
- 并使用
composer require doctrine/dbal
命令
回答by Mahendra Pratap
Run
跑
composer update
It will install your missing packages like PDOMySql.
它将安装您丢失的软件包,如 PDOMySql。
Or
或者
Delete vendor folder and run
删除供应商文件夹并运行
composer install
回答by A Hashemi
回答by Mateusz Sip
Can you share your current composer.json?
你能分享你当前的 composer.json 吗?
After composer.json update, you can execute composer install. It won't update existing packages (because of generated composer.lock), it'll only install new ones.
composer.json 更新后,您可以执行 composer install。它不会更新现有的包(因为生成的 composer.lock),它只会安装新的包。
What has changes since your last migration?
自上次迁移以来有哪些变化?
It's the same project in the same directory? If so, it should be there.
是同一个目录下的同一个项目吗?如果是这样,它应该在那里。
回答by Nancymic
OK thanks so much for the help. Stupidly, I had read that to do some other operations, that missing driver is called and I had tried to run a migration the other day to change a column name and what I completely forgot was that subsequent migrate runs are trying to still run that bad one. Once i remembered and deleted the update column name migration, my add table migration ran fine. With a project due in a few weeks, no package updates for me!!
好的,非常感谢您的帮助。愚蠢的是,我读过它来执行其他一些操作,调用了缺少的驱动程序,前几天我曾尝试运行迁移以更改列名,但我完全忘记了随后的迁移运行试图仍然运行那么糟糕一。一旦我记住并删除了更新列名迁移,我的添加表迁移就运行良好。几个星期后有一个项目到期,我没有包更新!!
回答by Silence
I saw this: To rename a column, you may use the renameColumn method on the Schema builder. Before renaming a column, be sure to add the doctrine/dbal dependency to your composer.json file:
我看到了这一点:要重命名列,您可以使用架构构建器上的 renameColumn 方法。在重命名一个列之前,一定要在你的 composer.json 文件中添加学说/dbal 依赖项:
it maybe work.
它也许工作。