I have below liquibase script for create table. This script is working fine in v3.5.5, but if I use v3.6.2 then its giving me "ArrayIndexOutOfBoundsException". It looks like liquibase is not bale to replace the property with the value based on DB. If I remove "${varcharUnit}" and change "java.sql.Types.VARCHAR(50${varcharUnit})" to "java.sql.Types.VARCHAR(50)" then its working fine with 3.6.2.
Any one has idea what changed in v3.6.2, which leading this error?
Need help to fix this issue.
Script:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
<property name="varcharUnit" value=" CHAR" dbms="oracle"/>
<property name="varcharUnit" value="" dbms="mysql"/>
<changeSet author="test" id="table-creation-2-1">
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="TEST" schemaName="${defaultSchema}"/></not>
</preConditions>
<createTable schemaName="${defaultSchema}" tableName="TEST" tablespace="TEST">
<column name="ID" type="java.sql.Types.BIGINT">
<constraints nullable="false"/>
</column>
<column name="NAME" type="java.sql.Types.VARCHAR(50${varcharUnit})">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>
Error:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at liquibase.datatype.DataTypeFactory.fromDescription(DataTypeFactory.java:251)
at liquibase.change.core.CreateTableChange.generateStatements(CreateTableChange.java:70)
at liquibase.change.AbstractChange.generateStatementsVolatile(AbstractChange.java:287)
at liquibase.change.AbstractChange.warn(AbstractChange.java:358)
at liquibase.changelog.visitor.ValidatingVisitor.visit(ValidatingVisitor.java:109)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:78)
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:269)
at liquibase.Liquibase.update(Liquibase.java:198)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:305)