Last active
May 7, 2018 10:49
-
-
Save mkacz/2c9b038cabe839f2723c31ae2179f800 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Creating dump # (If dump for Heroku add: --no-acl --no-owner) | |
| pg_dump -h localhost -U db_user db_name > dump_file.sql | |
| # Restoring dump | |
| sudo su postgres | |
| createuser -P --interactive db_owner | |
| createdb db_name --owner=db_owner --encoding=utf8 -l en_US.utf8 -T template0 | |
| # Optional if dump has been done withoud --no-acl --no-owner opts | |
| sed -i -e 's/OWNER TO old_user/OWNER TO db_owner/g' dump_file.sql | |
| psql db_name < dump_file.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment