Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Changing columns for table "hogehoges" requires Doctrine DBAL; install "doctrine/dbal".

More than 1 year has passed since last update.

事象

既存のテーブルのカラム情報(デフォルト値・Null許可等)を変更しようとした際、以下のようなエラーが出る。

$ php artisan migrate
In ChangeColumn.php line 30:
  Changing columns for table "hogehoges" requires Doctrine DBAL; install "doctrine/dbal".

解決方法

doctrine/dbalをインストールしなさいと言われているので、
composerでinstallするだけでよかった

$ composer require doctrine/dbal                                                                                                            ~/projects/Hoge
    Using version ^2.7 for doctrine/dbal
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
  - Installing doctrine/collections (v1.5.0): Downloading (100%)
  - Installing doctrine/cache (v1.7.1): Downloading (100%)
  - Installing doctrine/annotations (v1.6.0): Downloading (100%)
  - Installing doctrine/common (v2.8.1): Downloading (100%)
  - Installing doctrine/dbal (v2.7.1): 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
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravelcollective/html
Package manifest generated successfully.

もう一度。

$ php artisan migrate
Migrating: 2018_05_28_131641_add_options_to_hogehoges_table
Migrated:  2018_05_28_131641_add_options_to_hogehoges_table

成功。

所感

なんでこんな機能最初からインストールされてないんだろう・・・
カラムの情報変更とか結構やらないのかな

と思ってたけど、最初からちゃんとDBの設計ができていれば使わないのかー

hondy12345
渋谷で働いています。 メモ帳です。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away