Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for git #47

Open
qwazer opened this issue Mar 27, 2015 · 0 comments
Open

add support for git #47

qwazer opened this issue Mar 27, 2015 · 0 comments

Comments

@qwazer
Copy link
Owner

qwazer commented Mar 27, 2015

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%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant