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

      <small id='89oJc'></small><noframes id='89oJc'>

      <legend id='89oJc'><style id='89oJc'><dir id='89oJc'><q id='89oJc'></q></dir></style></legend>

      如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?

      时间:2023-06-03
    1. <i id='X6SMK'><tr id='X6SMK'><dt id='X6SMK'><q id='X6SMK'><span id='X6SMK'><b id='X6SMK'><form id='X6SMK'><ins id='X6SMK'></ins><ul id='X6SMK'></ul><sub id='X6SMK'></sub></form><legend id='X6SMK'></legend><bdo id='X6SMK'><pre id='X6SMK'><center id='X6SMK'></center></pre></bdo></b><th id='X6SMK'></th></span></q></dt></tr></i><div id='X6SMK'><tfoot id='X6SMK'></tfoot><dl id='X6SMK'><fieldset id='X6SMK'></fieldset></dl></div>
      1. <tfoot id='X6SMK'></tfoot>

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

              <bdo id='X6SMK'></bdo><ul id='X6SMK'></ul>

                  <tbody id='X6SMK'></tbody>
              • <legend id='X6SMK'><style id='X6SMK'><dir id='X6SMK'><q id='X6SMK'></q></dir></style></legend>

                本文介绍了如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一组 Sequelize 模型.我想使用迁移,而不是数据库同步.

                I have a set of Sequelize models. I want to use migrations, not DB Sync.

                Sequelize CLI 似乎能够做到这一点,根据 这篇文章:当您使用 CLI 生成模型时,您还将免费获得迁移脚本."

                Sequelize CLI seems to be able to do this, according to this article: "When you use the CLI for the model generation, you will gain the migration scripts for free as well."

                如何使用 Sequelize CLI 从现有的 Sequelize 模型自动生成迁移?

                How to auto generate the migrations with Sequelize CLI from existing Sequelize models?

                推荐答案

                如果您不想从头开始重新创建模型,可以使用以下 CLI 命令手动生成迁移文件:

                If you don't want to recreate your model from scratch, you can manually generate a migration file using the following CLI command:

                sequelize migration:generate --name [name_of_your_migration]

                这将生成一个空白的骨架迁移文件.虽然它不会将您的模型结构复制到文件中,但我确实发现它比重新生成所有内容更容易、更干净.注意:确保从迁移目录的包含目录运行命令;否则 CLI 会为你生成一个新的迁移目录

                This will generate a blank skeleton migration file. While it doesn't copy your model structure over to the file, I do find it easier and cleaner than regenerating everything. Note: make sure to run the command from the containing directory of your migrations directory; otherwise the CLI will generate a new migration dir for you

                这篇关于如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:无需重启服务器即可清除 MySQL 查询缓存 下一篇:强制 InnoDB 重新检查表/表上的外键?

                相关文章

                    <bdo id='LVpX7'></bdo><ul id='LVpX7'></ul>
                    <tfoot id='LVpX7'></tfoot>
                  1. <legend id='LVpX7'><style id='LVpX7'><dir id='LVpX7'><q id='LVpX7'></q></dir></style></legend>

                  2. <small id='LVpX7'></small><noframes id='LVpX7'>

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