I had and app on heroku then I decided to create another app (on cedar stack which does not support stack:migrate).
How can I migrate databases PG and MongoHq?
Thanks!
You can migrate MongoHQ by logging into heroku and clicking on addons => mongohq. From the application, create a new user under Database Users named "backup" with a simple password. Below, my password was "temppw". Then click the Database Info tab for your connection information (host:port [flame.mongohq.com:27049] and dbname [appXXXXXX]). Then just call mongodump to get a backup.
mongodump -h flame.mongohq.com:27049 -d appXXXXXX -u backup -p temppw
This will make a local directory called "dump" containing your data. Verify it is there by loading it into a local db (just run mongorestore and look in your local mongo install) - because when you destroy your old app, it destroys the MongoDB (heroku also destroys your postgres db - so you should do this for that as well).
Anyway, do the same as above to your new application database, except use mongorestore.
mongorestore -h flame.mongohq.com:27049 -d appXXXXXX -u backup -p temppw dump/appXXXXXX
DO NOT JUST POINT THE ENVIRONMENT URLS. This is dangerous, because deleting your initial app will destroy all of your data.
I'm not sure about MongoHQ but as for PostgreSQL, you can use Heroku Taps to pull the data from the remote database to your local machine. You could then push it to the new app.
Alternatively you could change the environment variable DATABASE_URL
of your new Cedar app to point to the database being used by the old app - assuming you're not using the shared database.
This last approach would also work for MongoHq.
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