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 >schema.sql"
|
8
|
exit 2
|
9
|
fi
|
10
|
if test -n "$data"; then
|
11
|
if test -n "$plain"; then dataOpts=--format=p
|
12
|
else dataOpts='--format=c --compress=9'
|
13
|
fi
|
14
|
else dataOpts=--schema-only
|
15
|
fi
|
16
|
test -n "$owners" && ownerOpts= || ownerOpts='--no-owner --no-privileges'
|
17
|
|
18
|
(set -x; "$selfDir/../bin/postgres_vegbien" pg_dump --schema="\"$1\"" \
|
19
|
$dataOpts $ownerOpts)
|