管理 Git 操作创建的 schema.rb 中的冲突

编程入门 行业动态 更新时间:2024-10-13 06:14:41
本文介绍了管理 Git 操作创建的 schema.rb 中的冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个迁移,运行了 rake db:migrate,这导致了我的 db/schema.rb 版本号.然后我做了一个 git fetch origin master 并看到我的团队成员有变化.所以我做了一个 git stash 和一个 git rebase FETCH_HEAD,然后是一个 git stash pop.这导致 db/schema.rb 中的版本号冲突.

I created a migration, ran rake db:migrate, which bumped my db/schema.rb version number. Then I did a git fetch origin master and saw that there were changes from my team members. So I did a git stash and a git rebase FETCH_HEAD, followed by a git stash pop. This resulted in a conflict in db/schema.rb over the version number.

Upstream>>> ActiveRecord::Schema.define(:version => 20110930179257) do =========== ActiveRecord::Schema.define(:version => 20110930161932) do <<<Stashed

我认为适当的解决方法是手动将版本号增加到高于上游的版本号.

I think the appropriate fix would be to manually increment the version number to something higher than the upstream.

这是明智的还是坏消息?

Is this sensible, or bad news?

谢谢,最大

推荐答案

如果您当前的数据库具有正确的架构,您应该:

If your current database has the correct schema, you should:

  • 运行挂起的迁移(如果有)

  • Run pending migrations (if any)

rake db:migrate

  • 从您当前的数据库架构覆盖您的 schema.rb

    rake db:schema:dump

  • 并提交

  • And commit

  • 更多推荐

    管理 Git 操作创建的 schema.rb 中的冲突

    本文发布于:2023-10-18 04:28:13,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1503109.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:冲突   操作   Git   rb   schema

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!