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?
If your project is deployed on Heroku Cloud Platform, you can easily make your changes using the CLI and deploy them to Heroku.
Heroku provides a great developer experience where your Git repository is your source of truth. Additionally, with Heroku, developers choose to build their apps in any language of their choice. They can speed up development with the help of Heroku add-ons. Some of the add-ons are free, while others are paid ones.
Attach the database as an add-on to other Heroku apps If you are connecting to a database from other Heroku apps, you can now attach a database add-on directly to multiple applications. This ensures that any changes to the database's URL will automatically propagate to your other apps.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With