symfonydoctrine-ormdoctrinesymfony4doctrine-migrations

--allow-empty-diff stopped working after upgrading to doctrine migrations 3


I have a deployment script that executes the migrations this way:

php bin/console doctrine:migrations:diff --allow-empty-diff --env=prod
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration --env=prod

And I am getting this error:

[ERROR] No changes detected in your mapping information.

Previously, before upgrading to migrations 3, the error was not being thrown. Once I upgraded it the error started to appear.

"doctrine/doctrine-bundle": "2.1.*",
"doctrine/doctrine-migrations-bundle": "3.1.*", // previously "2.2.*"
"doctrine/migrations": "3.2.*", // previously "2.2.*"

At first I thought that the --allow-empty-diff was removed in the new version, but when I run:

php bin/console doctrine:migrations:diff --help

I do see

--allow-empty-diff     Do not throw an exception when no changes are detected.

Any ideas?


Solution

  • It seems the functionality stills works the same as before. If no changes are detected, a message is printed to the console.

    However, the difference between 2.2.* and 3.6.* is that it the latter uses StyleInterface to style the message as an error instead of using the regular OutputInterface.

    In both cases, a exception is not thrown.

    See the code for 2.2.*
    See the code for 3.6.*