Bhadra
Bhadra

Reputation: 21

Liquibase modifysql tag with sql tag in same changeset not working

liquibase: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sql'. One of '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}' is expected.

Getting an error for this changeset

<changeSet id="18.7.0.1-1-userTable" author="so">
    <preConditions onFail="MARK_RAN">
        <not>
            <tableExists tableName="USER_CURRENT"/>
        </not>
    </preConditions>
    <createTable tableName="USER_CURRENT">
        <column name="name" type="VARCHAR(20)">
            <constraints primaryKey="true" nullable="false" primaryKeyName="name"/>
        </column>

    </createTable>
    <modifySql dbms="mysql">
        <append value=" PARTITION BY KEY() PARTITIONS 16"/>
    </modifySql>
    <modifySql dbms="oracle">
        <append value=" ORGANIZATION INDEX PARTITION BY HASH (name) PARTITIONS 16 PARALLEL 4"/>
    </modifySql>
    <sql>GRANT SELECT ON USER_CURRENT TO 'reportsUser'@'%';</sql>       
</changeSet>

Upvotes: 1

Views: 2986

Answers (1)

htshame
htshame

Reputation: 7330

The reason for it is that you can't have sql after modifySql tag inside the changeSet. You'll have either to put sql before modifySql or just to separate them into different changeSets.

It follows from dbchangelog-3.1.xsd.

Upvotes: 1

Related Questions