我创建了一个迁移,运行 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)
从您当前的数据库架构覆盖您的 schema.rb
rake db:schema:dump并提交
And commit
更多推荐
管理由 Git 操作创建的 schema.rb 中的冲突
发布评论