LoginSignup
11
2

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-05-28

事象

既存のテーブルのカラム情報(デフォルト値・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の設計ができていれば使わないのかー

11
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
2