我对我的 heroku 推送/部署过程有点不满,否则发现和使用它是一种乐趣.
I have a slight annoyance with my heroku push/deploy process, which otherwise has been a joy to discover and use.
如果我向我的应用程序添加一个新的迁移,我可以将它放到 heroku 服务器上的唯一方法是推送到 heroku 远程.这会上传它并重新启动应用程序.但它不运行迁移,所以我必须执行 heroku rake db:migrate --app myapp,然后 heroku restart --app myapp.与此同时,该应用程序已损坏,因为它尚未运行迁移,并且代码在迁移中引用了字段/表等.
If i add a new migration to my app, the only way i can get it up onto the heroku server is to do a push to the heroku remote. This uploads it and restarts the app. But it doesn't run the migration, so i have to do heroku rake db:migrate --app myapp, then heroku restart --app myapp. In the meantime, the app is broken because it hasn't run the migrations and the code is referring to fields/tables etc in the migration.
必须有一种方法来更改部署过程以自动运行 rake db:migrate 作为部署过程的一部分,但我无法解决.
There must be a way to change the deployment process to run the rake db:migrate automatically as part of the deploy process but i can't work it out.
这是我在 heroku cpanel 中设置的吗?这是我从命令行传递给 heroku 的一个选项吗?它是一个 git 钩子吗?谁能让我直截了当?谢谢,最大
Is it something i set in a heroku cpanel? Is it an option i pass to heroku from the command line? Is it a git hook? Can anyone set me straight? thanks, max
推荐答案这里有一个 rake 任务,它把所有东西都打包成一个单行(并且还支持回滚):
Here is a rake task that wraps up everything into a one-liner (and also supports rollback):
gist.github/362873
您仍然可能会在老板的演示之上进行部署,但至少您不会浪费时间在 git push 和 rake db:migrate 之间打字.
You still might wind up deploying on top of your boss's demo, but at least you don't waste time typing between the git push and the rake db:migrate.
更多推荐
Rails 3 和 Heroku:自动“rake db:migrate"推?
发布评论