I’m trying to use heroku db:push to upload my local postgresql database to the 5Mb shared database Heroku offers. Everything works fine but the database doesn’t mirror what I have on my local DB. Some of the records get duplicated and others are just missing. So if I had three records on my local db:
cat, dog, banana
when I use db:push I end up with:
dog, dog, cat
My DB has about 100,000 records 3-4 MB total. Any idea how I can fix this?
My database.yml:
development:
adapter: postgresql
encoding: unicode
database: myDB
username: myUname
password: myPw
host: localhost
port: 5432
reconnect: true
production:
adapter: postgresql
encoding: unicode
database: myDBname
username: myUname
password: myPW
host: ec2-23-21-140-215.compute-1.amazonaws.com
All this db info I took from
heroku config
Which gives a database URL with host, username, etc.
While convenient, using taps (what db:push uses) may not replicate your data exactly and may run into errors for larger transfers. To import or export data from your production system, we highly recommend using pgbackups instead.
https://devcenter.heroku.com/articles/import-data-heroku-postgres#from_postgres
https://devcenter.heroku.com/articles/pgbackups#importing_from_a_backup