I've been learning Ruby on Rails whilst开发者_如何学编程 making my first app for a couple of months now, and it's finally ready to start to be used by a few unlucky friends as beta testers. Problem is, I have no idea as to how to move from development to production. The app is on Heroku, and up to this point I've just been pushing the local development database to Heroku whenever I push the app.
I know I'm supposed to create a production database to put on Heroku, but how do I do this? Is there a guide somewhere? How do I manage the production database once it's on Heroku, if I need to run migrations on it?
Thanks for reading
heroku db:reset - remove all existing data heroku rake db:migrate - Run your migrations.
If your migrations are broken and you can't do what Ian suggested, you can always compose a bare initial production database locally and then push it up to Heroku. db:push
can take an argument to specify an alternate database to push.
But the way to manage the db on production is through heroku rake
and heroku console
. You can do pretty much anything you'd do locally through rake or the console.
Also worth noting that Heroku creates its own database.yml
entries for production for you automatically. No need to push your own to their git repo.
精彩评论