如何优化Django 1.8中的迁移

发布于 2025-02-13 19:50:37 字数 99 浏览 0 评论 0原文

我正在使用Django 1.8,并在迁移文件夹中拥有一个包含100多个文件的应用程序。 django中是否有任何办法而没有删除文件来“压缩”或“优化”这些迁移,以使我没有那么多的迁移?

I'm using Django 1.8 and have an app with over 100 files in the migration folder. Is there a way in Django without deleting the files to "compress" or "optimise" these migrations so I don't have so many of them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独﹏钓一江月 2025-02-20 19:50:37

您是否从Django文档中阅读了此部分?

挤压迁移¶

鼓励您自由进行迁移,而不必担心如何
你有很多;迁移代码已优化以处理数百个
一次没有太大的放缓。但是,最终您会想
从几百个迁移到只有几个,然后
那是挤压的地方。

来源: https://djangoproject.com/en/ 1.8/主题/迁移/

Have you read this part from the django docs?

Squashing migrations¶

You are encouraged to make migrations freely and not worry about how
many you have; the migration code is optimized to deal with hundreds
at a time without much slowdown. However, eventually you will want to
move back from having several hundred migrations to just a few, and
that’s where squashing comes in.

Source: https://docs.djangoproject.com/en/1.8/topics/migrations/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文