使用 Git 时如何处理 Doctrine 迁移?
我有一个由 git 控制源代码的 Zend Framework / Doctrine 1.2 项目。在 git 中从一个分支切换到另一个分支时,如何跟踪迁移类?
例如,
在分支 A 中,我有一个迁移类文件 (038_version.php)
在 分支 B 中,我有一个迁移类文件 (039_version.php)
Doctrine 将应用迁移 < em>按顺序基于文件名,所以我必须在分支 B 之前推出分支 A 中的功能,以便让 Doctrine 迁移正常工作。
我是否应该将所有迁移保留在自己的分支中并在上线之前更改数字?
I have a Zend Framework / Doctrine 1.2 project that is source controlled by git
. How do you keep track of migration classes when switching from branch to branch in git?
For example
In branch A I have a migration class file (038_version.php)
In branch B I have a migration class file (039_version.php)
Doctrine will apply the migrations sequentially based on the file name, so I have to push out the features in branch A before branch B in order to get Doctrine migration to work.
Should I just keep all migrations in its own branch and change the numbers before going live?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于分支的作用是隔离开发工作,如果您提出任务这取决于几个分支,所述分支妨碍了。
最好将所有这些分支合并到部署分支中,以便可视化 Doctrine 处理的相关文件。
NDM 敬请指出“复杂分支系统中的数据库迁移”以更好地说明OP的问题:
NDM 补充道:
Since a branch is there to isolate a development effort, if you ask a task which depends on several branches, said branches are in the way.
It may be better to merge all those branches in a deployment branch, in order to visualize the relevant files for Doctrine to work on.
NDM kindly points out to "Database migrations in a complex branching system" to better illustrate the OP's question:
NDM adds:
如果你遇到这种情况,你将永远不会有同步的分支。此外,如果您有干净的数据库(例如上线),则不需要迁移,只需在实时站点上删除它们,然后运行
它就会为您创建一个新的数据库迁移,然后您就可以参与游戏了。
If you have that scenario you will never have branches in sync. Additionally if you have clean DB like going live you do not need the migrations, just remove them on the live site, and run
And it will create you a new migration for the Db and you are in the game.