0
我是相当新的Git和我一直在使用多个分支机构,同时建立不同的使用功能,像git branch
,git checkout
命令开始,等等分支混帐,运行的迁移,并保持该模式功能
这里有一个列表步骤我已经采取了:
git checkout feature1
make some changes that include migrations
rake db:migrate
rake db:commit to feature1 with schema.rb
git checkout feature2
# at this point my schema appears to revert to pre-feature1
make some changes that involve a new migration
rake db:migrate
# schema now shows changes from BOTH feature1 and feature2.
的特点2运行rake db:migrate
的行为刷新的模式,这是我想象反映了我那既巩固特征1和特征的本地数据库。你知道我可以做些什么来保持这些迁移独立,因此每个功能可以有自己的模式,或者有另一种方法来处理分支迁移?
这不是'破坏我的应用程序' - 在feature2中运行'rake db:migrate'后,它只运行一次迁移,但架构正在更新以显示所有四个迁移。我猜是怎么回事,我的数据库每次检出一个新分支时都没有被更改为不同的迁移状态。 – sscirrus 2012-01-05 09:05:57
在feature2中运行'rake db:migrate'后,即使您在此之后签出feature1分支,您的数据库仍处于feature2的迁移版本中。 – Thomas 2012-01-05 09:10:36
对...所以我的问题是如何最有效地处理这个问题。为开发中的每个功能重新配置/重建新数据库似乎非常麻烦。 – sscirrus 2012-01-05 09:32:16