Answer the question
In order to leave comments, you need to log in
Doctrine migrations:diff generate new migrations every time?
doctrine:migrations:diff Generate a migration by comparing your current database to your mapping information.
doctrine:migrations:diff
there will be another same new migration. And then, of course, the script doctrine:migrations:migrate
throws errors that such fields already exist. For in the first migration there was an insertion of fields, and in the second there is an insertion.doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: App\Migrations
namespace: DoctrineMigrations\Infrastructure\Migrations
Answer the question
In order to leave comments, you need to log in
Because the first generated migration was not applied. The generator does compare schema and mapping, but it doesn't look at generated but not applied migrations. That is, there must be a doctrine:migrations:migrate between each doctrine:migrations:diff. Or you need to delete unused ones before generation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question