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 3388 aaronmk
    echo "Usage: env [data=1] [plain=1] [owners=1] $0 schema >schema.sql"
8 2092 aaronmk
    exit 2
9
fi
10 3397 aaronmk
11 3388 aaronmk
if test -n "$data"; then
12
    if test -n "$plain"; then dataOpts=--format=p
13
    else dataOpts='--format=c --compress=9'
14
    fi
15 3397 aaronmk
    owners=1
16 3388 aaronmk
else dataOpts=--schema-only
17
fi
18
test -n "$owners" && ownerOpts= || ownerOpts='--no-owner --no-privileges'
19 2092 aaronmk
20 3251 aaronmk
(set -x; "$selfDir/../bin/postgres_vegbien" pg_dump --schema="\"$1\"" \
21 3396 aaronmk
$dataOpts $ownerOpts --use-set-session-authorization)