ylluminate
ylluminate

Reputation: 12369

Transfer initial PostgreSQL database from development to Heroku production

I have an initial set of production data stored locally in the development database that I'd like to migrate to production for a starting point for data. What's the best way to transfer this data?

It does not seem evident if there is a way to use pgbackups as per the instructions. Perhaps I have to run a manual backup of some sort locally and then push it over with pgbackups and if that is the case, I'd appreciate some specific instructions on accomplishing this.

Upvotes: 2

Views: 1431

Answers (2)

mu is too short
mu is too short

Reputation: 434585

First dump your local database using pg_dump:

pg_dump -Fc --no-acl --no-owner -h ... mydb > mydb.dump

and then use heroku pgbackups:restore:

heroku pgbackups:restore heroku-database-url url-to-your-mydb.dump-file

Note that the mydb.dump file needs to be accessible by the Heroku servers.

The Heroku Dev Center page has detailed instructions:

https://devcenter.heroku.com/articles/heroku-postgres-import-export

Upvotes: 4

ylluminate
ylluminate

Reputation: 12369

After some additional digging and an answer from Heroku, the answer for importation of initial data is to:

1) If using PGSQL locally, first dump the data:

pg_dump -U your_username your_database_name -f backup.sql

2) Then follow the instructions found here for importation to Heroku's database: http://devcenter.heroku.com/articles/pgbackups#importing_from_a_backup

Upvotes: 6

Related Questions