John Smith
John Smith

Reputation: 6259

Transfer local PostgreSql database to heroku

I uploaded my application to heroku, recently im using PostgreSql also on my local machine, now i would like to know how i also can push my database with the existing records to Heroku? Is this possible?

Also it would be intresting if i can adopt my sql database to PostgreSql?

Thanks!

Upvotes: 0

Views: 148

Answers (1)

David Aldridge
David Aldridge

Reputation: 52336

You can use pg_restore to push a dump file from a local database to an Heroku database.

If you go to the Herokue Postgres page for the database they give connection settings for a number of utilities, one of them being pg_restore. The command will look similar to:

PGPASSWORD=jyb4fhiwyeioghfwc7hw pg_restore --verbose --clean --no-acl --no-owner -h ec2-23-254-171-15.eu-west-1.compute.amazonaws.com -U hqfy134fblqwheb -d sdjhufhqwuf -p 5432 [YOUR_DATA_FILE]

Just substitute in the name of your local file. If the Heroku database is completely empty you can omit the -clean option and save some time.

Upvotes: 1

Related Questions