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,30 +9,44 @@
|
||||||
|
|
||||||
# Contributed by Chris Farley - northernbrewer
|
# Contributed by Chris Farley - northernbrewer
|
||||||
|
|
||||||
|
# CarlosRuiz - added multidirectory management 2008/02/20
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: $0 DIRECTORY [commit]"
|
echo "Usage: $0 [DIRECTORY ... DIRECTORY] [commit]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "SET SQLBLANKLINES ON"
|
echo "SET SQLBLANKLINES ON"
|
||||||
echo "SET DEFINE OFF"
|
echo "SET DEFINE OFF"
|
||||||
echo "SPOOL `basename $1`"
|
echo "SPOOL `basename $1`"
|
||||||
for file in $1/*.sql; do
|
DIRINI=$1
|
||||||
echo "SELECT '`basename $file`' AS Filename FROM dual;"
|
COMMIT=0
|
||||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
while [ $# -gt 0 ]
|
||||||
echo
|
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
|
done
|
||||||
if [ -d $1/../processes_post_migration ]
|
if [ -d $DIRINI/../processes_post_migration ]
|
||||||
then
|
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;"
|
echo "SELECT '`basename $file`' AS Filename FROM dual;"
|
||||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ "$2" = "commit" ]; then
|
if [ $COMMIT -eq 1 ]
|
||||||
echo "COMMIT;"
|
then
|
||||||
|
echo "COMMIT;"
|
||||||
else
|
else
|
||||||
echo "ROLLBACK;"
|
echo "ROLLBACK;"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo "quit"
|
echo "quit"
|
|
@ -10,27 +10,41 @@
|
||||||
# Original contribution by by Chris Farley - northernbrewer
|
# Original contribution by by Chris Farley - northernbrewer
|
||||||
# Adapted to postgresql by Carlos Ruiz - globalqss
|
# Adapted to postgresql by Carlos Ruiz - globalqss
|
||||||
|
|
||||||
|
# CarlosRuiz - added multidirectory management 2008/02/20
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: $0 DIRECTORY [commit]"
|
echo "Usage: $0 [DIRECTORY ... DIRECTORY] [commit]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
for file in $1/postgresql/*.sql; do
|
DIRINI=$1
|
||||||
echo "SELECT '`basename $file`' AS Filename;"
|
COMMIT=0
|
||||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
while [ $# -gt 0 ]
|
||||||
echo
|
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
|
done
|
||||||
if [ -d $1/../processes_post_migration/postgresql ]
|
if [ -d $DIRINI/../processes_post_migration/postgresql ]
|
||||||
then
|
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;"
|
echo "SELECT '`basename $file`' AS Filename;"
|
||||||
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
cat $file | dos2unix | sed 's/commit[ ]*;//I'
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ "$2" = "commit" ]; then
|
if [ $COMMIT -eq 1 ]
|
||||||
echo "COMMIT;"
|
then
|
||||||
|
echo "COMMIT;"
|
||||||
else
|
else
|
||||||
echo "ROLLBACK;"
|
echo "ROLLBACK;"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo "quit"
|
echo "quit"
|
||||||
|
|
Loading…
Reference in New Issue