尝试 运行 down/rollback 命令时未发现 Doctrine Migration class 错误

Doctrine Migration class not found error when attempting to run down/rollback command

当我 运行 bin/console doctrine:migrations:list 我看到迁移列为:

Application\Migrations\Version20210909072642

我正在尝试回滚迁移,我尝试了几个不同的版本:

bin/console --env=dev doctrine:migrations:execute 'Application\DoctrineMigrations\Version20210909072642' --down --no-interaction -vvv
bin/console --env=dev doctrine:migrations:execute Version20210909072642 --down --no-interaction -vvv
bin/console --env=dev doctrine:migrations:execute 20210909072642 --down --no-interaction -vvv

最近的 DoctrineMigrationsBundle 更新是否更改了此功能?

每次我 运行 我都会收到以下错误:

In MigrationClassNotFound.php line 15:
                                                          
  [Doctrine\Migrations\Exception\MigrationClassNotFound]  
  Migration class "20210909072642" was not found?   

我的 Doctrine 配置如下所示:

doctrine_migrations:
    migrations_paths:
        'Application\Migrations': 'app/DoctrineMigrations'
    storage:
        table_storage:
            table_name: 'migration_versions'

migrations_paths 在您的配置中将迁移所在的命名空间设置为 Application\Migrations 而不是 Application\DoctrineMigrations.

运行 带有 Application\Migrations\Version20210909072642 的迁移命令。

bin/console --env=dev doctrine:migrations:execute \
'Application\Migrations\Version20210909072642' --down --no-interaction -vvv