Created
November 27, 2015 14:21
-
-
Save eduard-sukharev/fa50d3ae6bdf48ece59c to your computer and use it in GitHub Desktop.
Quick-n-dirty dumping and restoring postgres states for current GIT branch
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
| #!/bin/bash | |
| default_dump=`git symbolic-ref --short HEAD` | |
| CASE="${1:-$default_dump}" | |
| echo "Dumping to dump_$CASE.tar..." | |
| pg_dump --clean -h localhost -U postgres -F t -f dump_$CASE.tar db_name | |
| echo "Done" |
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
| #!/bin/bash | |
| default_restoration=`git symbolic-ref --short HEAD` | |
| CASE="${1:-$default_restoration}" | |
| echo "Restoring dump_$CASE..." | |
| pg_restore --clean -d db_name -h localhost -U postgres -F t dump_$CASE.tar | |
| echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment