|
ScriptTransformatorTool
Transform (migration) scripts from one DBMS dialect to another (postgres to oracle)
IntroductionTool can convert a migration sql script with ALTER-statements and other DDL-statements from one database dialect to another. All statements can cannot be transformed (because the parser cannot recognize them, remain unchanged). This helps to create migration script for multiple database in a project. Usagejava com.agimatec.dbtransform.ScriptTransformatorTool -conf db-conversion.xml -catalog catalog.xml -ftldir templates -dbms dbms -ftl templateBaseName -destdir targetDirectory -fromDir fromDir -targetDir targetdir -fromDbms fromDbms -overwrite true|false Options
Example: +tablespace=TEMP in template: ${tablespace} You can provide multiple properties to the template this way. Accessing static methods inside the freemarker templateThe template can access a predefined property "statics" to invoke static methods. See freemarker documentation for further details. Example: prints milliseconds into template by invoking System.currentTimeMillis(); ${statics["java.lang.System"].currentTimeMillis()}Property statics is BeansWrapper.getDefaultInstance().getStaticModels(). You could use this technique to access System.getProperty(). ExampleThe example syntax demonstrates the invocation of the ScriptTransformatorTool from the InvokerTool with ant (or the maven-antrun-plugin). You can imagine the native java call, can't you? <java fork="true" failonerror="true"
classname="com.agimatec.database.InvokerTool"
classpathref="maven.compile.classpath">
<jvmarg value="-Dfile.encoding=UTF-8"/>
<!-- transform up-*.sql scripts from postgres to oracle -->
<arg line="{ com.agimatec.dbtransform.ScriptTransformatorTool"/>
<arg line="-fromDbms postgres"/>
<arg line="-dbms oracle "/>
<arg line="-fromDir postgres/upgrade"/>
<arg line="-targetDir target/oracle/upgrade"/>
<arg line="-overwrite false"/>
<arg line="-ftldir templates }"/>
</java>
|