为什么需要将django迁移到版本控制系统 [英] Why there is need to push django migrations to version control system

查看:126
本文介绍了为什么需要将django迁移到版本控制系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个常见的做法,在django项目上工作的人通常会将迁移与其他代码一起推送到版本控制系统。

This is a common practice that people working on django project usually push migrations to the version control system along with other code.

我的问题是为什么这种做法是共同?为什么不推送更新的模型,并且每个人都在本地生成迁移。这种方法可以减少解决迁移冲突的努力。

My question is why this practice is so common? Why not just push the updated models and everyone generate migrations locally. This approach can reduce the effort for resolving migrations conflicts too.

推荐答案

如果没有将它们提交给VCS,那么人们会对模型产生潜在的冲突变化。

If you didn't commit them to a VCS then what would happen is people would make potentially conflicting changes to the model.

当终于准备好部署时,您仍然需要django进行新的迁移,然后将所有的更改合并在一起。而且这只会产生一个额外的不必要的步骤,可以引入错误。

When finally ready to deploy, you would still need django to make new migrations that would then merge everybodys changes together. And this just creates an additional unnecessary step that can introduce bugs.

你也假设每个人都将永远能够使用最新版本的代码当您开始在尚未准备好合并到主干线的分支机构上工作时,总是有可能。

You also are assuming everybody will always be able to work on an up to date version of the code which isn't always possible when you start working on branches that are not ready to be merged into mainline.

这篇关于为什么需要将django迁移到版本控制系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆