How can I import a .sql file into my Heroku postgres database?

后端 未结 4 1620
慢半拍i
慢半拍i 2020-12-04 11:09

I have a backup sql file from another database that I want to import into Heroku\'s postgres database. How do you do that?

4条回答
  •  离开以前
    2020-12-04 11:32

    Making backup file:

    pg_dump -U USERNAME DATABASE --no-owner --no-acl -f backup.sql 
    

    Restoring from sql file to heroku :

    heroku pg:psql --app APPNAME < backup.sql 
    

    (Bonus) Deleting all tables from heroku app database (example):

    heroku pg:reset --app APPNAME HEROKU_POSTGRESQL_ROSE
    

    get DATABASE_URL from posgresql heroku panel (psql line)

提交回复
热议问题