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

View File

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

View File

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

View File

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

View File

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