laravel renameColumn 修改資料庫欄位出現錯誤

 3,319 total views,  3 views today

今天把資料庫調整一下,使用migrate建立jobs還正確,結果要修改user資料表欄位居然出錯,出現了錯誤訊息。

Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found

後來原來要安裝doctrine/dbal套件才行,這不是laravel內建的指令,怎麼需要另外裝套件呢? 我也不知道反正能跑就行。

composer require doctrine/dbal
Using version ^2.9 for doctrine/dbal
./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 (v1.0.0): Downloading (100%)
  - Installing doctrine/cache (v1.8.0): Downloading (100%)
  - Installing doctrine/dbal (v2.9.2): Downloading (100%)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: albertcht/invisible-recaptcha
Discovered Package: barryvdh/laravel-cors
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: chumper/zipper
Discovered Package: davejamesmiller/laravel-breadcrumbs
Discovered Package: dingo/api
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: realrashid/sweet-alert
Discovered Package: recca0120/laravel-tracy
Discovered Package: recca0120/terminal
Discovered Package: torann/geoip
Package manifest generated successfully.

接下來,在下php artisan migrate就成功了。

Migrating: 2019_04_01_134329_add_status_to_users_table
Migrated:  2019_04_01_134329_add_status_to_users_table

發表迴響

%d 位部落客按了讚: