gpt4 book ai didi

php - 尝试运行向下/回滚命令时找不到 Doctrine Migration 类错误

转载 作者:行者123 更新时间:2023-12-05 00:52:45 25 4
gpt4 key购买 nike

当我运行 bin/console dictionary:migrations:list 时,我看到 Migration 列为:

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

关于php - 尝试运行向下/回滚命令时找不到 Doctrine Migration 类错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69218666/

25 4 0