はじめに
symfony4.4のdoctrineの説明をみながらマイグレーションを操作した。
Migrations & Adding more Fieldsで追加したdescriptionカラムの変更を、doctrineは検知をせず、以下のように無情な回答。
php bin/console make:migration
[WARNING] No database changes were detected.
操作した内容をどこかに記録していると予想していたけど、調査したら、var配下のCacheに保存をしている模様。
以下のようにキャッシュをクリアしたら。。。
php bin/console doctrine:cache:clear-metadata
// Clearing all Metadata cache entries
[OK] Successfully deleted cache entries.
正常にマイグレーション用のファイルを作成しました!!
php bin/console make:migration
Success!
Next: Review the new migration "src/Migrations/Version20191123063407.php"
Then: Run the migration with php bin/console doctrine:migrations:migrate
See https://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
おまけ
参考文献にある、以下のコマンドを実行したら、強制的にDBにカラムが追加をされていました。
php bin/console doctrine:schema:update --force
Updating database schema...
1 query was executed
こちらはEntityからSQLを作成して、即実行をするコマンドでした。
php bin/console doctrine:schema:update --help
・・・
Alternatively, you can execute the generated queries:
doctrine:schema:update --force