symfonydoctrinesymfony5doctrine-migrations

Symfony doctrine:execute can't find Doctrine migrations in custom folder


We've set our configuration file for doctrine migrations as the following:

doctrine_migrations:
    migrations_paths:
        'App\Migrations': "%kernel.project_dir%/src/Migrations"

Our migrations command all work, for example, doctrine:migrations:migrate works, doctrine:migrations:list will list all the migrations in our /src/Migrations folder. However, we cannot execute the doctrine:migrations:execute <versionNumber> command because it will give an error that it cannot find the migration file: "Migration class "20220329211652" was not found?"

Does doctrine:migrations:execute not work for custom migration paths configuration? When placing these migrations back in the default folder, it works.


Solution

  • It worked by using a fully qualified class name like:

    bin/console doctrine:migrations:execute "App\Migrations\Version20220329211652"