echo " rebuild"
echo " psql"
echo " piped"
- echo " add <filesql>"
+ echo " add <filesql> [<filesql2> [..]]"
+ echo " del <filesql> [<filesql2> [..]]"
+ echo " res <filesql> [<filesql2> [..]]"
echo " dump [dumpfile]"
echo " dumpall [dumpfile]"
echo " all"
test "$DBPORT" != "" && pg_args="$pg_args -p $DBPORT"
test "$DBBASE" != "" && pg_args="$pg_args $DBBASE"
-MATCH_DROP='^drop|^alter table.* drop '
+MATCH_DROP='^drop|^alter table.* drop |^delete '
case $CMD in
"create")
fi
;;
"add")
- cat "$1" | sqlexe
+ ( echo "-- MESG: add start" ; cat "$@" | egrep -iv "$MATCH_DROP" ; echo "-- MESG: add end" ; ) | sqlexe
+ ;;
+ "del")
+ ( echo "-- MESG: del start" ; cat "$@" | egrep -i "$MATCH_DROP" | tac ; echo "-- MESG: del end" ; ) | sqlexe
+ ;;
+ "res")
+ ( echo "-- MESG: res start" ; cat "$@" | egrep -i "$MATCH_DROP" | tac ; cat "$@" | egrep -iv "$MATCH_DROP" ; echo "-- MESG: del end" ; ) | sqlexe
;;
"help"|"-h"|"--help")
usage 0
;;
esac
-exit 0
\ No newline at end of file
+exit 0