maxenglander maxenglander - 6 months ago 36
Git Question

Managing conflict in schema.rb created by Git operation

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.

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

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
  • Overwrite your schema.rb from your current database schema

    rake db:schema:dump
  • And commit