Did not check it, but it can work.
Do this to get the URL of the source database:
heroku console "ENV['DATABASE_URL']" --app mysourceapp
Then try db:push with this.
heroku db:push database_url_from_before --app mytargetapp
This may not work if Heroku does not allow access to the database machines from outside their network, which is probably the case. You could perhaps try using taps (gems ββthat use the db hero commands inside) from your application code somewhere (maybe a rake task). This will be even faster than the above approach, because everything stays completely within AWS.
Edit:
Here's a (admittedly hacky) way to do what I described above:
Take the URL of the database, as in the first code snippet above. Then from the rake task (you can do it on the console, but you run the risk of running a 30 second timeout on console commands), run the shell command for taps (it's not easy to determine if taps can be used directly from Ruby; docs show the use of the CLI):
`taps pull database_url_from_source_app #{ENV['DATABASE_URL']}`
Reverse steps are important; this is how Ruby stands for a shell command that has taps in it. We hope that the crane team is available from the application. This avoids the problem of accessing the database machine from outside Heroku, since you are using this command from your application.
tfe 05 Oct '10 at 6:44 2010-10-05 06:44
source share