oracle-ddl2svn icon indicating copy to clipboard operation
oracle-ddl2svn copied to clipboard

add support for git

Open qwazer opened this issue 10 years ago • 0 comments

add support for git

@echo off
rem DESCRIPTION
rem two-step script
rem 1) get DDLs from oracle schema
rem 2) auto-commit DDLs in SVN

rem REQUREMENTS
rem java must be installed
rem svn console client must be installed
rem output dir must be under version control in svn

rem SET PARAMETERS
rem first parameter is DB_URL
rem second parameter is OUTPUT_DIR
rem you can overwrite this parameters
set DB_URL=
set OUTPUT_DIR=
set GIT_BRANCH=autotrack_TEST2
set COMMIT_MESSAGE="automatic commit by oracle-ddl2git"

set WORKING_DIR=%cd%

rem test db connection,
rem if db connect is fail, do not perform any filesystem operation, only clean tmp file end exit
echo =========  start of test db connection %date% %time% ==============
set tempfile=connection.tmp
del %tempfile%
java -jar scheme2ddl.jar --test-connection -url %DB_URL% > %tempfile% 2>&1
find "FAIL connect to" %tempfile%
if not errorlevel 1 goto :exit

:runScript
rem delete all files from output directory exept system files
rem this command must keep on disk svn meta information stored in .svn folders
echo =========  start of scheme2ddl %date% %time% ==============
cd %OUTPUT_DIR%
git checkout %GIT_BRANCH%
git clean -f -d
git rm -rf .
git -c core.quotepath=false checkout HEAD -- .tgitconfig .gitignore
cd %WORKING_DIR%
java -jar scheme2ddl.jar -url %DB_URL% -output %OUTPUT_DIR% -c scheme2ddl.config.xml
echo =========  end of scheme2ddl %date% %time% ==============

cd %OUTPUT_DIR%
git add -A
git commit -m %COMMIT_MESSAGE%
git push

:exit
cd %WORKING_DIR%
del %tempfile%

qwazer avatar Mar 27 '15 12:03 qwazer