Preparing to migrate from 320 to 340
Added multidirectory management to the scripts example to generate one complete script to migrate from 320 to trunk migrate.sh 320-330 330-331b 331b-trunk commit
This commit is contained in:
parent
4e75193030
commit
4e05ff082f
|
@ -9,27 +9,41 @@
|
|||
|
||||
# Contributed by Chris Farley - northernbrewer
|
||||
|
||||
# CarlosRuiz - added multidirectory management 2008/02/20
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 DIRECTORY [commit]"
|
||||
echo "Usage: $0 [DIRECTORY ... DIRECTORY] [commit]"
|
||||
exit 0
|
||||
fi
|
||||
echo "SET SQLBLANKLINES ON"
|
||||
echo "SET DEFINE OFF"
|
||||
echo "SPOOL `basename $1`"
|
||||
for file in $1/*.sql; do
|
||||
DIRINI=$1
|
||||
COMMIT=0
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
DIR=$1
|
||||
shift
|
||||
if [ "$DIR" = "commit" ]; then
|
||||
COMMIT=1
|
||||
else
|
||||
for file in $DIR/*.sql; do
|
||||
echo "SELECT '`basename $file`' AS Filename FROM dual;"
|
||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||
echo
|
||||
done
|
||||
fi
|
||||
done
|
||||
if [ -d $1/../processes_post_migration ]
|
||||
if [ -d $DIRINI/../processes_post_migration ]
|
||||
then
|
||||
for file in $1/../processes_post_migration/*.sql; do
|
||||
for file in $DIRINI/../processes_post_migration/*.sql; do
|
||||
echo "SELECT '`basename $file`' AS Filename FROM dual;"
|
||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||
echo
|
||||
done
|
||||
fi
|
||||
if [ "$2" = "commit" ]; then
|
||||
if [ $COMMIT -eq 1 ]
|
||||
then
|
||||
echo "COMMIT;"
|
||||
else
|
||||
echo "ROLLBACK;"
|
||||
|
|
|
@ -10,24 +10,38 @@
|
|||
# Original contribution by by Chris Farley - northernbrewer
|
||||
# Adapted to postgresql by Carlos Ruiz - globalqss
|
||||
|
||||
# CarlosRuiz - added multidirectory management 2008/02/20
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 DIRECTORY [commit]"
|
||||
echo "Usage: $0 [DIRECTORY ... DIRECTORY] [commit]"
|
||||
exit 0
|
||||
fi
|
||||
for file in $1/postgresql/*.sql; do
|
||||
DIRINI=$1
|
||||
COMMIT=0
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
DIR=$1
|
||||
shift
|
||||
if [ "$DIR" = "commit" ]; then
|
||||
COMMIT=1
|
||||
else
|
||||
for file in $DIR/postgresql/*.sql; do
|
||||
echo "SELECT '`basename $file`' AS Filename;"
|
||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||
echo
|
||||
done
|
||||
fi
|
||||
done
|
||||
if [ -d $1/../processes_post_migration/postgresql ]
|
||||
if [ -d $DIRINI/../processes_post_migration/postgresql ]
|
||||
then
|
||||
for file in $1/../processes_post_migration/postgresql/*.sql; do
|
||||
for file in $DIRINI/../processes_post_migration/postgresql/*.sql; do
|
||||
echo "SELECT '`basename $file`' AS Filename;"
|
||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||
echo
|
||||
done
|
||||
fi
|
||||
if [ "$2" = "commit" ]; then
|
||||
if [ $COMMIT -eq 1 ]
|
||||
then
|
||||
echo "COMMIT;"
|
||||
else
|
||||
echo "ROLLBACK;"
|
||||
|
|
Loading…
Reference in New Issue