我正在不同的 yaml 架构文件之间生成迁移:即运行:
I'm generating migrations between different yaml schema files: i.e. running:
symfony 学说:生成迁移差异
symfony doctrine:generate-migrations-diff
生成的迁移文件包含大量未在上次架构文件更改中添加的 changeColumn 调用.
And the resulting migration file has a whole slew of changeColumn calls that weren't added in the last schema file change.
例如,如果您在不更改架构文件的情况下运行 generate-migrations-diff,则应该得到一个空的 up() 函数.但是,为我生成的函数对我的数据库中的几乎每个表都有一个 changeColumn 调用.
For example, if you run generate-migrations-diff without changing your schema file whatsoever, you should get an empty up() function. However, the function that results for me has a changeColumn call for virtually every table in my database.
是我做错了什么还是这是一个错误?
Am i doing something wrong or is this a bug?
generate-migrations-diff 不会区分两个不同的 yaml 文件.它实际上会比较您的模型和 yaml 文件,然后根据差异生成迁移.如果您从与您的 yaml 和类同步的数据库开始,则进行架构更改的工作流程应该是:
The generate-migrations-diff doesn't diff two different yaml files. It actually compares your models and your yaml file and then generates a migration based on the differences. If you start from a db that is in sync with your yaml and classes, your workflow to make schema changes should be:
这篇关于Doctrine 中的额外 changeColumns generate-migrations-diff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!