Improvements on migrate.sh

- Allow execution from remote directory
- Apply processes_post_migration if exists
This commit is contained in:
Carlos Ruiz 2008-01-23 16:20:03 +00:00
parent 57c25ef08b
commit c41a0bfb58
5 changed files with 19 additions and 5 deletions

View File

@ -15,15 +15,24 @@ if [ -z "$1" ]; then
fi
echo "SET SQLBLANKLINES ON"
echo "SET DEFINE OFF"
echo "SPOOL $1"
for file in `ls $1`; do
echo "SELECT '$file' AS Filename FROM dual;"
dos2unix $1/$file
cat $1/$file | sed 's/commit[ ]*;//I'
echo "SPOOL `basename $1`"
for file in $1/*.sql; do
echo "SELECT '`basename $file`' AS Filename FROM dual;"
cat $file | dos2unix | sed 's/commit[ ]*;//I'
echo
done
if [ -d $1/../processes_post_migration ]
then
for file in $1/../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
echo "COMMIT;"
else
echo "ROLLBACK;"
fi
echo
echo "quit"

View File

@ -65,3 +65,4 @@ BEGIN
DBMS_OUTPUT.PUT_LINE ('End');
COMMIT;
END;
/

View File

@ -1,5 +1,6 @@
-- Synchronize Terminology
/*
-- take account of the output for these two selects
SELECT DISTINCT columnname, NAME, description, HELP, entitytype
@ -14,6 +15,7 @@ SELECT DISTINCT columnname, NAME, description, HELP, entitytype
FROM AD_ELEMENT e
WHERE UPPER (p.columnname) = UPPER (e.columnname));
*/
-- execute
INSERT INTO AD_ELEMENT_TRL

View File

@ -116,3 +116,4 @@ BEGIN
COMMIT;
DBMS_OUTPUT.PUT_LINE ('End');
END;
/

View File

@ -78,3 +78,4 @@ BEGIN
COMMIT;
END;
/