Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean DB and include commands to create it when dumping

  • Loading branch information...
commit 515f53d767e6c44a4139e5df4d01c04459aa13b7 1 parent da77b1b
@gabebw authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 zsh/postgres.zsh
View
8 zsh/postgres.zsh
@@ -3,7 +3,13 @@ export PSQL_EDITOR="vim -c ':set ft=sql'"
# db-dump DB_NAME
function db-dump() {
- pg_dump -Fc -f database.dump "$1" && echo Wrote to database.dump
+ if [[ $# == 1 ]]
+ then
+ pg_dump --clean --create -Fc -f database.dump "$1" && echo Wrote to database.dump
+ else
+ echo "Usage: db-dump DB_NAME"
+ exit 1
+ fi
}
# db-restore DB_NAME
Please sign in to comment.
Something went wrong with that request. Please try again.