<bdo id='JaDGT'></bdo><ul id='JaDGT'></ul>
      <legend id='JaDGT'><style id='JaDGT'><dir id='JaDGT'><q id='JaDGT'></q></dir></style></legend>

      <small id='JaDGT'></small><noframes id='JaDGT'>

    1. <tfoot id='JaDGT'></tfoot>

        <i id='JaDGT'><tr id='JaDGT'><dt id='JaDGT'><q id='JaDGT'><span id='JaDGT'><b id='JaDGT'><form id='JaDGT'><ins id='JaDGT'></ins><ul id='JaDGT'></ul><sub id='JaDGT'></sub></form><legend id='JaDGT'></legend><bdo id='JaDGT'><pre id='JaDGT'><center id='JaDGT'></center></pre></bdo></b><th id='JaDGT'></th></span></q></dt></tr></i><div id='JaDGT'><tfoot id='JaDGT'></tfoot><dl id='JaDGT'><fieldset id='JaDGT'></fieldset></dl></div>

        Doctrine 中的额外 changeColumns generate-migrations-diff

        时间:2024-08-09
          <bdo id='dhZQP'></bdo><ul id='dhZQP'></ul>
            <tbody id='dhZQP'></tbody>

          <i id='dhZQP'><tr id='dhZQP'><dt id='dhZQP'><q id='dhZQP'><span id='dhZQP'><b id='dhZQP'><form id='dhZQP'><ins id='dhZQP'></ins><ul id='dhZQP'></ul><sub id='dhZQP'></sub></form><legend id='dhZQP'></legend><bdo id='dhZQP'><pre id='dhZQP'><center id='dhZQP'></center></pre></bdo></b><th id='dhZQP'></th></span></q></dt></tr></i><div id='dhZQP'><tfoot id='dhZQP'></tfoot><dl id='dhZQP'><fieldset id='dhZQP'></fieldset></dl></div>
          <tfoot id='dhZQP'></tfoot>

                <legend id='dhZQP'><style id='dhZQP'><dir id='dhZQP'><q id='dhZQP'></q></dir></style></legend>

                <small id='dhZQP'></small><noframes id='dhZQP'>

                  本文介绍了Doctrine 中的额外 changeColumns generate-migrations-diff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在不同的 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:

                  1. 更改 yaml 文件
                  2. generate-migrations-diff 将您当前的(已更改的)yaml 与您的(未更改的)模型进行比较.这将在您的教义/迁移目录中生成一个迁移文件(或在您的教义配置中设置的任何迁移路径).
                  3. migrate 运行在第 2 步中创建的迁移并修改您的数据库
                  4. generate-models-yaml 根据您的 yaml 文件生成新类.这些位于您指定生成模型的位置(您的学说配置中的models_path).
                  5. generate-sql 生成 SQL 文件.这将转到您的学说 sql_path 配置设置的位置.
                  1. Change yaml file
                  2. generate-migrations-diff to diff your current (changed) yaml with your (unchanged) models. This will generate a migrations file in your doctrine/migrations directory (or whatever migrations_path is set to in your doctrine config).
                  3. migrate to run the migration created in step 2 and modify your database
                  4. generate-models-yaml to generate new classes based on your yaml file. These go where you've specified your generated models go (models_path in your doctrine config).
                  5. generate-sql to generate a SQL file. This will go where your doctrine sql_path config is set to.

                  这篇关于Doctrine 中的额外 changeColumns generate-migrations-diff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:不允许 ResultSetMappingBuilder 工作的原则 下一篇:Symfony2 YAML 实体字段未绑定

                  相关文章

                  <small id='ThcoI'></small><noframes id='ThcoI'>

                    <legend id='ThcoI'><style id='ThcoI'><dir id='ThcoI'><q id='ThcoI'></q></dir></style></legend>

                    <i id='ThcoI'><tr id='ThcoI'><dt id='ThcoI'><q id='ThcoI'><span id='ThcoI'><b id='ThcoI'><form id='ThcoI'><ins id='ThcoI'></ins><ul id='ThcoI'></ul><sub id='ThcoI'></sub></form><legend id='ThcoI'></legend><bdo id='ThcoI'><pre id='ThcoI'><center id='ThcoI'></center></pre></bdo></b><th id='ThcoI'></th></span></q></dt></tr></i><div id='ThcoI'><tfoot id='ThcoI'></tfoot><dl id='ThcoI'><fieldset id='ThcoI'></fieldset></dl></div>

                    • <bdo id='ThcoI'></bdo><ul id='ThcoI'></ul>
                  1. <tfoot id='ThcoI'></tfoot>