Postgres copy Heroku Production DB to local development DB

后端 未结 6 2071
误落风尘
误落风尘 2020-12-23 11:44

I have a heroku database, d76mj7ltuqs.

I then have a local database, test_development.

The schema is the same on both of these data

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 12:13

    clean your local database:

    rake db:schema:load
    

    dump your heroku database:

    heroku pg:backups:capture -r <**your production git repo name**>
    heroku pg:backups:download -r <**your production git repo name**>
    

    load data in your local database

    pg_restore --verbose --clean --no-acl --no-owner -h localhost -d <**test database name**> latest.dump
    

提交回复
热议问题