updateDatabase Task

Roll the database forward applying all changesets that have not been run.

updateDatabase task examples

<liquibase:updateDatabase  changeLogFile="/path/to/changeLog.xml">  
	<liquibase:database  driver="${db.driver}"  url="${db.url}"  user="${db.user}"  password="${db.pasword}"/>  
</liquibase:updateDatabase>

A basic implementation of the update database task. Applies updates in the changelog file to the database.

<database  id="my-database"  driver="${driver.classname}"  url="${jdbc.url}"  user="${username}"  password="${password}"/>  
<liquibase:updateDatabase  databaseRef="my-database"  changelogFile="/path/to/changeLog.xml"/>

Updates the referenced database with the changeset found in the given changelog file.

<liquibase:updateDatabase  changeLogFile="/path/to/changeLog.xml">  
	<liquibase:database  driver="${db.driver}"  url="${db.url}"  user="${db.user}"  password="${db.pasword}"/>  
	<liquibase:changeLogParameters>  
		<liquibase:changeLogParameter  name="property1"  value="value1"/>  
		<liquibase:changeLogParameter  name="property2"  value="value2"/>  
		<propertyset>  
			<propertyref  prefix="mydb"/>  
		</propertyset>  
	</liquibase:changeLogParameters>  
</liquibase:updateDatabase>

Updates the database with the changelog file, substituting any changelog parameters present with values defined in the nested elements.

Parameters

Attribute Description Required
changeLogFile The changelog file to run. Yes
contexts A comma separated list of Contexts to execute. If not specified, all contexts are run. No
outputFile If specified, Liquibase will save the update SQL statements to the specified file rather than executing them in the database. No
outputEncoding The character encoding to use when writing SQL statements to output file. No; defaults to system encoding.
promptOnNonLocalDatabase If set to true a dialog box with warn you if you attempt to run the Liquibase against a database that is not on localhost. No; default is false.
dropFirst If set to true, Liquibase will first drop all database objects owned by the connected user. No; default is false
classpathref A reference to the classpath used to run the task with. No
databaseref A reference to the database that Liquibase will connect to. Yes, unless a nested <database> element is present.
driver Deprecated: Name of the database driver to connect with. No
url Deprecated: Use <database>'s url attribute instead. The database URL. No
username Deprecated:The database username to connect with. No
password Deprecated:The password to use when connecting to the database. No
defaultSchemaName Deprecated:Schema to use by default for managed database objects and Liquibase control tables. No
currentDateTimeFunction Deprecated: Overrides current date time function used in SQL. Useful for unsupported databases. No
databaseChangeLogTableName Deprecated: Overrides the name of the DATABASECHANGELOG table to use. No
databaseChangeLogLockTableName Deprecated: Overrides the name of the DATABASECHANGELOGLOCK table to use. No
logLevel Deprecated: Specifies one of the following logging levels: debug, info, warning, severe, off. The default level is info. No

Parameters specified as nested elements

classpath

The classpath used to run the task with. Optional.

database

Required unless a databaseref attribute is given. See database data type.

changelogparameters

Optional. See changelog Property Substitution.