rc211v-mbp:backend ros2$ php artisan migrate
Migrating: 2020_12_07_191937_add_provider_users_table
Error
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
at vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php:89
85▕ * @return \Doctrine\DBAL\Driver\PDOMySql\Driver
86▕ */
87▕ protected function getDoctrineDriver()
88▕ {
➜ 89▕ return new DoctrineDriver;
90▕ }
91▕ }
92▕
+8 vendor frames
9 database/migrations/2020_12_07_191937_add_oauth_users_table.php:22
Illuminate\Support\Facades\Facade::__callStatic("table")
+22 vendor frames
32 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
タイトルの通り、doctrine/dbalをインストールしても「Doctrine\DBAL\Driver\PDOMySql\Driver」エラーが発生して、「Doctrine\DBAL\Driver\PDOMySql\Driver」で検索すると「composer require doctrine/dbal」が必要という記事がよく見つかります。
「composer require doctrine/dbal」は成功しています。
Using version ^3.0 for doctrine/dbal
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/socialite
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: rcrowe/twigbridge
Package manifest generated successfully.
78 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
ですがファイル「Doctrine\DBAL\Driver\PDOMySql\Driver」はvendorにないので、どうやらバージョンが不一致のようです。
バージョン指定なしでインストールして「3.0」が入っていましたが、Githubで2系の情報をみると、「Doctrine\DBAL\Driver\PDOMySql\Driver」があるので、Laravelのマイグレーションでは2系をインストールする必要があります。
composer require "doctrine/dbal:2.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
- Installing doctrine/event-manager (1.1.1): Loading from cache
- Installing doctrine/cache (1.10.2): Loading from cache
- Installing doctrine/dbal (2.12.1): Downloading (100%)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
2系をインストール後にmigrateを実行すると成功!
$ php artisan migrate
Migrating: 2020_12_07_191937_add_provider_users_table
Migrated: 2020_12_07_191937_add_provider_users_table (230.26ms)