How to copy staging data to review app on heroku postgres
I ran into this problem as I was setting up the review app on heroku.
I do have enough seed file to run app, but not enough to run all tests.
Here is how I solved with postdeploy script in app.json
{
"name": "test_app",
"scripts": {
"postdeploy": "pg_dump $STAGING_DATABASE_URL | psql $DATABASE_URL && bundle exec rake db:migrate"
},
"env": {
"STAGING_DATABASE_URL": {
"required": true
},
}
"addons": [
"heroku-postgresql",
],
"buildpacks": [
{
"url": "heroku/ruby"
}
]
}
NOTE: You need to set STAGING_DATABASE_URL
in parent app first
Written by naohiro
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Heroku
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#