1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/noalyss_ynh.git synced 2024-09-03 19:46:20 +02:00
noalyss_ynh/sources/contrib/sql-utility/get-sql.sh
2015-09-27 00:54:25 +02:00

28 lines
410 B
Bash
Executable file

#!/bin/bash
#
#
# Author Dany De Bontridder
# Under the GPL 2 minimun
#
Help () {
cat <<_eof
$0 [option] database
-f function only
-t table only
_eof
}
if [ $# -lt 2 ]; then
Help
fi
case "$1" in
-f)
pg_dump -s "$2"|awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}'
;;
-t)
pg_dump -s "$2"| awk '/CREATE TABLE/,/;/ { print $0;}'
pg_dump -s "$2"| awk '/ALTER TABLE/,/;/ { print $0;}'
;;
esac