2

最近有一个更新到第 3 版的原则迁移,这是作为供应商库升级的一部分,所以我们现在有点被迫遵循;)

我们是这样配置的:

doctrine_migrations:
    migrations_paths:
        "DoctrineMigrations": "src/Migrations"

    storage:
        table_storage:
            table_name: 'migration_versions'
            version_column_name: 'version'
            version_column_length: 1024
            executed_at_column_name: 'executed_at'
            execution_time_column_name: 'execution_time'

然而,我们得到以下奇怪的迁移错误。

bin/console doctrine:migrations:status给出这个“一切正常”的输出:

+----------------------+----------------------+------------------------------------------------------------------------+
| Configuration                                                                                                        |
+----------------------+----------------------+------------------------------------------------------------------------+
| Storage              | Type                 | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
|                      | Table Name           | migration_versions                                                     |
|                      | Column Name          | version                                                                |
|----------------------------------------------------------------------------------------------------------------------|
| Database             | Driver               | Doctrine\DBAL\Driver\PDOMySql\Driver                                   |
|                      | Name                 | dwconnect2                                                             |
|----------------------------------------------------------------------------------------------------------------------|
| Versions             | Previous             | DoctrineMigrations\Version20200522213838                               |
|                      | Current              | DoctrineMigrations\Version20200608142225                               |
|                      | Next                 | Already at latest version                                              |
|                      | Latest               | DoctrineMigrations\Version20200608142225                               |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 18                                                                     |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 18                                                                     |
|                      | New                  | 0                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | DoctrineMigrations   | src/Migrations                                                         |
+----------------------+----------------------+------------------------------------------------------------------------+

但是如果我们运行bin/console doctrine:migrations:migrate --no-interaction它会抛出以下错误:

[ERROR] The version "latest" couldn't be reached, you are at version "DoctrineMigrations\Version20200608142225"  

我们的数据库看起来不错,因为我们已将其清除并且所有迁移都是新鲜的。

非常感谢任何帮助!
安德烈亚斯

4

1 回答 1

2

因此,感谢原始 github 问题上的回复

bin/console doctrine:migrations:migrate --allow-no-migration --no-interaction

这会将错误转换为警告。

于 2020-06-17T15:44:56.933 回答