|
DBMigrateXmlScript
xml script features
If you need to invoke java-beans, you cannot do that in sql scripts. You can use a xml script instead which gives you more control about the migration process. Example<config>
<list name="Operations">
<text name="doSQLScript" value="subscript.sql"/>
<!--<text name="halt" value="manually perform something"/>-->
<text name="doSQLScriptIgnoreErrors" value="subscript.sql"/>
<text name="version" value="2.0.16"/>
</list>
</config>Featureslist "Operations" is mandatory and contains the migration steps to execute. text name="" is a public method in class BaseMigrationTool (or a subclass) The methods get a single string parameter. <text name="doSQLScript" value="subscript.sql"/> invokes public void doSQLScript(String parameter); // parameter="subscript.sql" Predefined Operations
Execute a SQL-Script (parse statements). Fail on SQLExceptions.
<text name="invokeBean" value="com.agimatec.database.InsertJasperReport#save(2,user-chart.jrxml)"/>
invoke a static n-arg-method on a class. All parameters of the target method must be of type String!
invoke dbunit, parameters are delete-data-set (optional) and import-data-set(mandatory). Examples: <text name="dbSetup" value="delete_data.xml,data.xml"/> <text name="dbSetup" value="data.xml"/> see DbUnitSetupTool
Explicit program stop. Some migration steps might require manual activities by the administrator. The migration program can execute until this step and invoke a halt. The given parameter will be printed and logged.
Copy one or multiple files (URLs) from a source to a target location. The parameter is the name of the list in the environment with source-target file names. Example: copy file:sourceDir/fileA.txt to targetDir/fileA.txt <map name="env">
<ArrayList name="files-to-copy">
<String value="file:sourceDir/fileA.txt"/>
<String value="file:targetDir/fileA.txt/>
</ArrayList>
</map>
<list name="Operations">
<text name="copyFiles" value="files-to-copy"/>
</list>You can use ${property} in file names. You can rename a file copied. Examplesa) no parameter <text name="doGroovyScript" value="importProductsCsv.groovy"/> b) 2 parameters <text name="doGroovyScript" value="importProductsCsv.groovy(products.txt,myapp)"/>
Check if database contains invalid Trigger, Indices, Views. Parameter: databaseType ("oracle", "postgres")
Compare schema of database with SQL-Scripts. 1. Parameter: databaseType ("oracle", "postgres") 2. (Comma-separated) Name of env-entries, that contains a list of Strings, that are File-URLs. These files are .sql-Files, which will be parsed und compared with the physical database schema (read from the database). This is a mightly operation that allows to check whether all schema elements (columns, keys, tables) are correctly migrated. Example<config>
<map name="env">
<ArrayList name="sqlfiles">
<String value="file:setup/application-tables.sql"/>
<String value="file:setup/history-tables.sql"/>
</ArrayList>
</map>
<list name="Operations">
<text name="checkObjectsValid" value="oracle"/>
<text name="checkSchemaComplete" value="oracle,sqlfiles"/>
</list>
</config>
conditional execution with | ||||||