开发者

How to properly manage migrations for dev and prod environments?

We have a decent-sized development team with a few concurrent projects being developed on the same code line. Sometimes we add migrations that are okay to run in development environment but should not be run in prod for a few months due to that project's release schedule. This has caused us to stick with Rails' original numbered migrations, rather than timestamped, since we can easily migrate up to a certain magic number and hav开发者_开发技巧e all of the prod migrations after this magic number.

It totally feels like we're doing it wrong. We still have the issue of developers creating the same numbered migration. We can't simply keep a project on a branch for a while because the branch will diverge from trunk.

Is there a method or tool that anyone's encountered that deals with migration issues like this?


You are definitely doing it wrong ;)

Effectively managing multiple 'targets' requires a good vcs. I'd suggest git or mercurial, as good branching (and merging) support is essential.

  • do use timestamped migrations: duplicates issue solved.
  • keep migrations that shouldn't (yet) go to production on a non production branch. you can deploy 'master' to production and develop on feature branches or you can have a 'production' branch and develop on master. either way you wont run migrations on production until you really need to.
  • merge 'production' branch into your development branches frequently -> diverging issue solved.
  • if there is only one person working on a topic branch, he can 'git rebase' instead of merging the production branch to keep development history linear.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜