2

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.

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

2 Comments

Right. I tried but it told me I had to wait a day. :) Not sure why ppl have been voting my question down. LOL Thanks for the input.
Thanks for the help. Seems strange to me as I thought it was rather clear: "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." I don't know how it an be much more clear. Oh well! :)
4

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

8 Comments

Understood, however I thought that this was "dangerous" from some of what I read.
Additionally, are you familiar with setting up of Synchronous Replication between a remote Heroku pgsql server and, for example, local servers?
@ylluminate: db:push might be dangerous if you already have production data but you don't have any so there's nothing to overwrite or lose. I'm not familiar with replication at Heroku.
db push is for this exact purpose. It will be fine.
I do have some production data. It is archived data that I've collecting for some time (several million rows of data). It's not complex and there are no foreign keys / joins involved in the particularly large table with the most complex data type being a numeric(18,12).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.