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>|all} [opts...] \
|
8
|
>out"|fold -s >&2
|
9
|
exit 2
|
10
|
fi
|
11
|
|
12
|
schema="$1"
|
13
|
shift
|
14
|
test "$schema" != all && set -- --schema="\"$schema\"" "$@"
|
15
|
|
16
|
if test -n "$data"; then
|
17
|
if test -n "$plain"; then set -- "$@" --format=p
|
18
|
else set -- "$@" --format=c --compress=9
|
19
|
fi
|
20
|
owners=1
|
21
|
else set -- "$@" --schema-only
|
22
|
fi
|
23
|
test -n "$owners" || set -- "$@" --no-owner --no-privileges
|
24
|
set -- "$@" --use-set-session-authorization
|
25
|
|
26
|
set -x
|
27
|
exec "$selfDir/postgres_vegbien" pg_dump "$@"
|