Doctrine migrations:diff generates each time a new migration?

doctrine:migrations:diff Generate a migration by comparing your current database to your mapping information.

The idea is that it should compare the current database and mapping that is specified in the annotation I have in the Entity. However, for some reason each time it generates a new migration to the Entity. That is, if I have 1 Entity that already have migration did not change anything in the mapping, after the entry doctrine:migrations:diff is one is the same new migration. And then, of course, the script doctrine:migrations:migrate throws error that the field is already there. For the first migration was the insert fields, and the second is insert.

 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

It will throw an error that this namespace is not because it really is not.
namespace: DoctrineMigrations\Infrastructure\Migrations

Why is it every time generates a new migration?
June 10th 19 at 16:19
1 answer
June 10th 19 at 16:21
Because the generated first migration was not applied. Generator and compares the schema and the mapping, but he's not looking at the generated, but not applied migrations. That is between each doctrine:migrations:diff must be doctrine:migrations:migrate. Or need to remove unapplied before generation.

Find more questions by tags Doctrine ORM