|
CatalogGeneratorTool
tool to transform a catalog description from one dbms to another
IntroductionRead a postgres catalog (xml or serialized file) and convert all column names, data types etc. to an oracle catalog. Conversion rules for data types, column length, constraint names can be configured in the -conf file (db-conversion.xml). A default db-conversion.xml file is provided (checkout the dbmigrate project from SVN or download dbmigrate-example-project.zip). Usagejava com.agimatec.dbtransform.CatalogGeneratorTool -conf db-conversion.xml -catalog catalog.xml -ftldir templates -dbms dbms -ftl templateBaseName -destdir targetDirectory 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(). ExampleUsagejava com.agimatec.dbtransform.CatalogGeneratorTool -conf db-conversion.xml -catalog target/my-catalog-postgres.xml -outputCatalog target/my-catalog-oracle.xml -dbms oracle -destdir oracle/setup -ftldir templates -ftl create-tables -outputPrefix my- db-conversion.xmlfor details see class CatalogConversion <conversion>
<name>Postgres to Oracle</name>
<maxLengthForConstraints>30</maxLengthForConstraints>
<filterIndices>true</filterIndices>
<dataTypes>
<transformation>
<source>
<typeName>CHARACTER VARYING</typeName>
</source>
<target>
<typeName>VARCHAR2</typeName>
</target>
</transformation>
<transformation>
<source>
<typeName>TEXT</typeName>
</source>
<target>
<typeName>CLOB</typeName>
</target>
</transformation>
<transformation>
<source>
<typeName>SMALLINT</typeName>
</source>
<target>
<typeName>NUMBER</typeName>
<precision>5</precision>
<precisionEnabled>true</precisionEnabled>
</target>
</transformation>
</dataTypes>
</conversion>
|
► Sign in to add a comment