1
|
#!/bin/sh
|
2
|
# Dumps a schema of the vegbien db
|
3
|
|
4
|
selfDir="$(dirname -- "$0")"
|
5
|
|
6
|
if ! test "$#" -eq 1; then
|
7
|
echo "Usage: env [data=1] [plain=1] [owners=1] $0 [schema] [opts...] >out"
|
8
|
exit 2
|
9
|
fi
|
10
|
|
11
|
if test "${1#-}" = "$1"; then # $1 does not start with "-"
|
12
|
schemaOpt=--schema="\"$1\""
|
13
|
shift
|
14
|
set -- "$schemaOpt" "$@"
|
15
|
fi
|
16
|
|
17
|
if test -n "$data"; then
|
18
|
if test -n "$plain"; then dataOpts=--format=p
|
19
|
else dataOpts='--format=c --compress=9'
|
20
|
fi
|
21
|
owners=1
|
22
|
else dataOpts=--schema-only
|
23
|
fi
|
24
|
test -n "$owners" && ownerOpts= || ownerOpts='--no-owner --no-privileges'
|
25
|
|
26
|
(set -x; "$selfDir/../bin/postgres_vegbien" pg_dump "$@" \
|
27
|
$dataOpts $ownerOpts --use-set-session-authorization)
|