在这个问题中,我特别关注以下情况:
123_add_foo.rb
456_add_bar.rb
选项1
合并schema.rb
文件时,结果将为
create_table "something", :force => true do |t|
...
t.string "foo" # foo was added to schema.rb earlier, so appears first
t.string "bar"
end
选项2
但是,运行rake db:migrate
会导致重新排序为
create_table "something", :force => true do |t|
...
t.string "bar" # bar was added to the master branch first
t.string "foo" # so this appears before foo here
end
问题
哪个schema.rb
应存储在版本控制中?
选项2与迁移服务器时会发生的情况相匹配 - 这是否与从头开始迁移时不会发生的情况相匹配?