org.dbmaintain.maven.plugin
Class UpdateDatabaseMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.dbmaintain.maven.plugin.BaseMojo
          extended by org.dbmaintain.maven.plugin.BaseDatabaseMojo
              extended by org.dbmaintain.maven.plugin.UpdateDatabaseMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class UpdateDatabaseMojo
extends BaseDatabaseMojo

Task that updates the database to the latest version.

Author:
Tim Ducheyne, tiwe

Field Summary
protected  Boolean allowOutOfSequenceExecutionOfPatches
          If this property is set to true, a patch script is allowed to be executed even if another script with a higher index was already executed.
protected  Boolean autoCreateDbMaintainScriptsTable
          Sets the autoCreateDbMaintainScriptsTable property.
protected  Boolean cleanDb
          Indicates whether the database should be 'cleaned' before scripts are executed.
protected  Boolean disableConstraints
          If set to true, all foreign key and not null constraints of the database are automatically disabled before and after the execution of the scripts.
protected  String excludedQualifiers
          Optional comma-separated list of script qualifiers.
protected  Boolean fromScratchEnabled
          Sets the fromScratchEnabled property, that indicates the database can be recreated from scratch if needed.
protected  String includedQualifiers
          Optional comma-separated list of script qualifiers.
protected  String patchQualifiers
          The qualifier to use to determine whether a script is a patch script.
protected  String postProcessingScriptDirectoryName
          Comma separated list of directories and files in which the post processing database scripts are located.
protected  String qualifiers
          Optional comma-separated list of script qualifiers.
protected  List<ScriptArchiveDependency> scriptArchiveDependencies
          Defines where the scripts can be found that must be executed on the database.
protected  String scriptEncoding
          Encoding to use when reading the script files.
protected  String scriptFileExtensions
          Sets the scriptFileExtensions property, that defines the extensions of the files that are regarded to be database scripts.
protected  String scriptLocations
          Defines where the scripts can be found that must be executed on the database.
protected  String scriptParameterFile
          Sets the scriptParameterFile property.
protected  Boolean updateSequences
          If set to true, all sequences and identity columns are set to a sufficiently high value, so that test data can be inserted without having manually chosen test record IDs clashing with automatically generated keys.
protected  Boolean useLastModificationDates
          Defines whether the last modification dates of the scripts files can be used to determine whether the contents of a script has changed.
 
Fields inherited from class org.dbmaintain.maven.plugin.BaseDatabaseMojo
databases
 
Fields inherited from class org.dbmaintain.maven.plugin.BaseMojo
artifactFactory, configFile, localRepository, mavenProjectHelper, project, remoteRepositories, resolver
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
UpdateDatabaseMojo()
           
 
Method Summary
protected  DbMaintainTask createDbMaintainTask(List<DbMaintainDatabase> dbMaintainDatabases)
           
 
Methods inherited from class org.dbmaintain.maven.plugin.BaseDatabaseMojo
createDbMaintainTask, getAllScriptLocations, getDbMaintainDatabases
 
Methods inherited from class org.dbmaintain.maven.plugin.BaseMojo
execute, getMavenProperties, performAfterTaskActions
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scriptArchiveDependencies

protected List<ScriptArchiveDependency> scriptArchiveDependencies
Defines where the scripts can be found that must be executed on the database. Multiple dependencies may be configured. At least one scriptArchiveDependency or scriptLocation (can be both) must be defined.


scriptLocations

protected String scriptLocations
Defines where the scripts can be found that must be executed on the database. Multiple locations may be configured, separated by comma's. A script location can be a folder or a jar file. This property is required. At least one scriptArchiveDependency or scriptLocation (can be both) must be defined.


scriptEncoding

protected String scriptEncoding
Encoding to use when reading the script files. Defaults to ISO-8859-1


postProcessingScriptDirectoryName

protected String postProcessingScriptDirectoryName
Comma separated list of directories and files in which the post processing database scripts are located. Directories in this list are recursively search for files. Defaults to postprocessing


fromScratchEnabled

protected Boolean fromScratchEnabled
Sets the fromScratchEnabled property, that indicates the database can be recreated from scratch if needed. From-scratch recreation is needed in following cases: If set to false, DbMaintain will give an error if one of these situations occurs. The default is false.


autoCreateDbMaintainScriptsTable

protected Boolean autoCreateDbMaintainScriptsTable
Sets the autoCreateDbMaintainScriptsTable property. If set to true, the table DBMAINTAIN_SCRIPTS will be created automatically if it does not exist yet. If false, an exception is thrown, indicating how to create the table manually. False by default.


allowOutOfSequenceExecutionOfPatches

protected Boolean allowOutOfSequenceExecutionOfPatches
If this property is set to true, a patch script is allowed to be executed even if another script with a higher index was already executed.


qualifiers

protected String qualifiers
Optional comma-separated list of script qualifiers. All custom qualifiers that are used in script file names must be declared.


patchQualifiers

protected String patchQualifiers
The qualifier to use to determine whether a script is a patch script. Defaults to patch. E.g. 01_#patch_myscript.sql


includedQualifiers

protected String includedQualifiers
Optional comma-separated list of script qualifiers. All included qualifiers must be registered using the qualifiers property. Only scripts which are qualified with one of the included qualifiers will be executed.


excludedQualifiers

protected String excludedQualifiers
Optional comma-separated list of script qualifiers. All excluded qualifiers must be registered using the qualifiers property. Scripts qualified with one of the excluded qualifiers will not be executed.


cleanDb

protected Boolean cleanDb
Indicates whether the database should be 'cleaned' before scripts are executed. If true, the records of all database tables, except for the ones listed in 'dbMaintainer.preserve.*' or 'dbMaintain.preserveDataOnly.*' are deleted before and after executing the scripts. False by default.


disableConstraints

protected Boolean disableConstraints
If set to true, all foreign key and not null constraints of the database are automatically disabled before and after the execution of the scripts. False by default.


updateSequences

protected Boolean updateSequences
If set to true, all sequences and identity columns are set to a sufficiently high value, so that test data can be inserted without having manually chosen test record IDs clashing with automatically generated keys.


useLastModificationDates

protected Boolean useLastModificationDates
Defines whether the last modification dates of the scripts files can be used to determine whether the contents of a script has changed. If set to true, DbMaintain will not look at the contents of scripts that were already executed on the database, if the last modification date is still the same. If it did change, it will first calculate the checksum of the file to verify that the content really changed. Setting this property to true improves performance: if set to false the checksum of every script must be calculated for each run. True by default.


scriptFileExtensions

protected String scriptFileExtensions
Sets the scriptFileExtensions property, that defines the extensions of the files that are regarded to be database scripts. The extensions should not start with a dot. The default is 'sql,ddl'.


scriptParameterFile

protected String scriptParameterFile
Sets the scriptParameterFile property. If set, the corresponding properties file will be loaded and all occurrences of parameters in the script that match a property will be replaced by the corresponding property value. Script parameters are formatted as in ${param}.

Constructor Detail

UpdateDatabaseMojo

public UpdateDatabaseMojo()
Method Detail

createDbMaintainTask

protected DbMaintainTask createDbMaintainTask(List<DbMaintainDatabase> dbMaintainDatabases)
Specified by:
createDbMaintainTask in class BaseDatabaseMojo


Copyright © 2011. All Rights Reserved.