Example Changelogs: XML Format

Liquibase supports XML as a format for storing your changelog files. There is more information about the XML format in the FAQ

XSD support

XML Schema Definitions (XSDs) are available for each Liquibase version. However, if you use the earliest versions of XSD files, any new features that require new XML tags will not be available. Since there are no changelog format changes in patch versions, there are only XSD files that correspond to major.minor versions.

Tip: See the XML Schema Definitions topic for more information.

Liquibase contains XSD files locally and does not need to retrieve them from the internet to validate your XML. If you use custom XSD files in your changelog, Liquibase needs to download them to validate XML. By default, Liquibase does not automatically download non-local XSD files. To change this behavior, set the liquibase.secureParsing parameter to false in the Liquibase properties file, in the CLI, with JAVA_OPTS, or as an environment variable. For more information, see Working with Command Parameters.

Alternatively, add your custom XSD to a JAR in Liquibase's classpath using the format <hostname>/<path>. For example, if your XSD has the location https://<hostname>.com/<path>/changelog.xsd, store your XSD JAR in the path /<hostname>.com/<path>/changelog.xsd. For information on setting your classpath, see How Liquibase Finds Files: Liquibase Classpath.

Liquibase extension XSDs

If you use a Liquibase extension that includes additional change tags, check the extension documentation to find out if they provide a XSD. If they do not, you can use the XSD at dbchangelog-ext.xsd which allows any nested tag and attribute.


<?xml version="1.0" encoding="UTF-8"?>	
		http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
		http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd">
        <runningAs  username="liquibase"/>  

    <changeSet  id="1"  author="nvoxland">  
        <createTable  tableName="person">  
            <column  name="id"  type="int"  autoIncrement="true">  
                <constraints  primaryKey="true"  nullable="false"/>  
            <column  name="firstname"  type="varchar(50)"/>  
            <column  name="lastname"  type="varchar(50)">  
                <constraints  nullable="false"/>  
            <column  name="state"  type="char(2)"/>  

    <changeSet  id="2"  author="nvoxland">  
        <addColumn  tableName="person">  
            <column  name="username"  type="varchar(8)"/>  
    <changeSet  id="3"  author="nvoxland">  
            existingTableName="person"  existingColumnName="state"  
            newTableName="state"  newColumnName="id"  newColumnDataType="char(2)"/>  


Related Links