Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push local PostgreSQL database to remote Heroku server

On windows 7, I want to push my local PostgreSQL database(9.4.0) to remote PostgreSQL server on Heroku(9.3.3), I followed the Heroku PostgreSQL Document to push:

>heroku pg:push postgres HEROKU_POSTGRESQL_NAVY_URL --app salty-atoll-4222

Your version of git is 1.9.5.. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
'env' is not recognized as an internal or external command,
operable program or batch file.
Password:
 !    WARNING: Extensions in newly created target database differ from existing source database.
 !
 !    Target extensions:
 !     extname
 !    ---------
 !     plpgsql
 !    (1 row)
 !
 !
 !    Source extensions:
 !      extname
 !    -----------
 !     adminpack
 !     plpgsql
 !    (2 rows)
 !
 !
 !    HINT: You should review output to ensure that any errors
 !    ignored are acceptable - entire tables may have been missed, where a dependency
 !    could not be resolved. You may need to to install a postgresql-contrib package
 !    and retry.

My local database server URL is localhost:5432. Both the username and database name are postgres, and I've add PGUSER and PGPASSWORD to my system variable, also, my DATABASE_URL system variable is postgres://postgres:password@localhost:5432/postgres.

Also, since it says 'env' is not recognized as an internal or external command, operable program or batch file., I guess set command can be use to replace env, so I also added a alias env.bat in C:\Windows\System32\env.bat:

@ECHO OFF
set

But it still can't recognized env command and my PGPASSWORD variable, asks me to type my password by hand, shows the same warning and my database can't be pushed to this remote server. What's the problem here?

like image 577
user3684014 Avatar asked Dec 29 '14 04:12

user3684014


1 Answers

On Windows, the ENV variables need to be configured differently on Heroku, I don't see in your question if you tried this already:

heroku config:set GITHUB_USERNAME=joesmith
Adding config vars and restarting myapp... done, v12
GITHUB_USERNAME: joesmith

$ heroku config
GITHUB_USERNAME: joesmith
OTHER_VAR:    production

$ heroku config:get GITHUB_USERNAME
joesmith

$ heroku config:unset GITHUB_USERNAME
Unsetting GITHUB_USERNAME and restarting myapp... done, v13

More related documentation can be found here.

like image 59
raviolicode Avatar answered Sep 30 '22 15:09

raviolicode