Project

General

Profile

1 2092 aaronmk
#!/bin/sh
2
# Dumps a schema of the vegbien db
3
4
selfDir="$(dirname -- "$0")"
5
6
if ! test "$#" -eq 1; then
7 6022 aaronmk
    echo "Usage: env [schema=1] [data=1] [plain=1] [owners=1] [opts=...] $0 \
8 5672 aaronmk
{<schema>|all} [opts...] >out"|fold -s >&2
9 2092 aaronmk
    exit 2
10
fi
11 3397 aaronmk
12 6024 aaronmk
schema_="$1"
13 3406 aaronmk
shift
14 6024 aaronmk
test "$schema_" != all && set -- --schema="\"$schema_\"" "$@"
15 3400 aaronmk
16 3388 aaronmk
if test -n "$data"; then
17 3401 aaronmk
    if test -n "$plain"; then set -- "$@" --format=p
18
    else set -- "$@" --format=c --compress=9
19 3388 aaronmk
    fi
20 3397 aaronmk
    owners=1
21 6022 aaronmk
elif test -n "$schema"; then set -- "$@" --schema-only
22 3388 aaronmk
fi
23 3401 aaronmk
test -n "$owners" || set -- "$@" --no-owner --no-privileges
24 5672 aaronmk
set -- "$@" $opts
25 2092 aaronmk
26 3401 aaronmk
set -x
27
exec "$selfDir/postgres_vegbien" pg_dump "$@"