I've looked at Heroku's Taps project (http://devcenter.heroku.com/articles/taps) but there's a huge constraint on foreign keys, so I'm uncomfortable with using开发者_高级运维 this.
All I want to do is get my production data safely and put it on my staging app so the two are more closely matched. Advice?
Thoughtbot posted this a few weeks ago:
You need the pgbackups addon (free), and use this to transfer from production to staging
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
Gist here: https://gist.github.com/1095522
Edit: Make sure you have your git branches "staging" and "production" pointing to the heroku apps.
git remote add production production_heroku_app
git remote add staging staging_heroku_app
If your staging app is using Postgre SQL as well, you can export your data as a backup using pgbackup (http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup) and then just copy it into your db folder. If not, you may have to use a conversion tool.
精彩评论